woocommerce_coupon_get_discount_amount

woocommerce_coupon_get_discount_amount

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_coupon_get_discount_amount') is found 2 times:

  • /includes/class-wc-discounts.php line 392
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    $discount = floor( $price_to_discount * ( $coupon_amount / 100 ) );
     
    if ( is_a( $this->object, 'WC_Cart' ) && has_filter( 'woocommerce_coupon_get_discount_amount' ) ) {
        // Send through the legacy filter, but not as cents.
        $filtered_discount = wc_add_number_precision( apply_filters( 'woocommerce_coupon_get_discount_amount', wc_remove_number_precision( $discount ), wc_remove_number_precision( $price_to_discount ), $item->object, false, $coupon ) );
     
        if ( $filtered_discount !== $discount ) {
            $discount              = $filtered_discount;
            $adjust_final_discount = false;
        }
    }
  • /includes/class-wc-discounts.php line 457
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    }
     
    if ( is_a( $this->object, 'WC_Cart' ) && has_filter( 'woocommerce_coupon_get_discount_amount' ) ) {
        // Send through the legacy filter, but not as cents.
        $discount = wc_add_number_precision( apply_filters( 'woocommerce_coupon_get_discount_amount', wc_remove_number_precision( $discount ), wc_remove_number_precision( $price_to_discount ), $item->object, false, $coupon ) );
    }
     
    $discount       = min( $discounted_price, $discount );
    $total_discount = $total_discount + $discount;
    $applied_count  = $applied_count + $apply_quantity;