Is there a Woocommerce hook that fires when applying a coupon but before checking if it's valid?
I want to add an item to the cart (that same item gets discounted with the coupon) upon using a coupon code (with a hook).
E.g. when using the coupon code SAMPLECODE, a product is added to the cart with a $2 discount. The coupon is set up to apply a $2 discount for that product only.
The problem is, that my coupon code only applies to the item that is going to be added programmatically, so it fails the eligibility check and doesn't get to woocommerce_applied_coupon
.
So is there a hook that fires before checking if the coupon is valid?
Or should I just do it via javascript when applying a coupon? Is there a way to do it via AJAX?