Reputation: 822
I am using woo-commerce and have 2 restrictions for coupons:
minimum value and maximum value
When the total value of the cart is either lower than the minimum value or higher than the maximum value, the coupon won't be applied.
Regarding this, I would like to alter this functionality, and only apply a coupon when the total value of the cart exceeds the maximum value. I would also like to apply the discount on only the amount of maximum value, not on the whole cart.
Lets look at on an example:
If the maximum value of the coupon is 100$ and has a 10% discount, while the total value of a cart is 200$, then after applying the coupon, the whole cart should cost 190$ and not 180$.
Summarized: where can I change the functionality of coupons to work like this?
Upvotes: 0
Views: 982
Reputation: 822
i found that :)
this filter:
woocommerce_coupon_get_discount_amount
more info at:
woocommerce/includes/class-wc-coupon.php //Line 597
Function: get_discount_amount
Upvotes: 1