woocommerce_coupon_get_discount_amount filter in coupon class

Closes #5244
This commit is contained in:
Mike Jolley 2014-04-07 10:26:43 +01:00
parent 192c74eee6
commit fc906b12d8
1 changed files with 3 additions and 2 deletions

View File

@ -522,8 +522,9 @@ class WC_Coupon {
*/
$discount_percent = 0;
if ( WC()->cart->subtotal_ex_tax )
if ( WC()->cart->subtotal_ex_tax ) {
$discount_percent = ( $cart_item['data']->get_price_excluding_tax() * $cart_item['quantity'] ) / WC()->cart->subtotal_ex_tax;
}
$discount = min( ( $this->amount * $discount_percent ) / $cart_item['quantity'], $discounting_amount );
} else {
@ -542,7 +543,7 @@ class WC_Coupon {
}
}
return $discount;
return apply_filters( 'woocommerce_coupon_get_discount_amount', $discount, $discounting_amount, $cart_item, $single, $this );
}
/**