woocommerce_coupon_get_discount_amount
Usage
add_filter( 'woocommerce_coupon_get_discount_amount', 'wp_kama_woocommerce_coupon_get_discount_amount_filter', 10, 5 ); /** * Function for `woocommerce_coupon_get_discount_amount` filter-hook. * * @param $NumberUtil::round * @param $discounting_amount * @param $cart_item * @param $single * @param $that * * @return */ function wp_kama_woocommerce_coupon_get_discount_amount_filter( $NumberUtil::round, $discounting_amount, $cart_item, $single, $that ){ // filter... return $NumberUtil::round; }
- $NumberUtil::round
- -
- $discounting_amount
- -
- $cart_item
- -
- $single
- -
- $that
- -
Where the hook is called
woocommerce_coupon_get_discount_amount
woocommerce_coupon_get_discount_amount
woocommerce_coupon_get_discount_amount
woocommerce/includes/class-wc-coupon.php 488-495
return apply_filters( 'woocommerce_coupon_get_discount_amount', NumberUtil::round( min( $discount, $discounting_amount ), wc_get_rounding_precision() ), $discounting_amount, $cart_item, $single, $this );
woocommerce/includes/class-wc-discounts.php 392
$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 ) );
woocommerce/includes/class-wc-discounts.php 457
$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 ) );