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.3.3

apply_filters('woocommerce_coupon_get_discount_amount') is found 2 times:

  • /includes/class-wc-discounts.php line 391
    			$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 456
    			}
    
    			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;