php - What is the best WooCommerce hook for implementing custom coupons? -


i have plugin allows using coupons stored on separate system. using various filters (e.g., woocommerce_get_shop_coupon_data) coupon code entered checked against web api see if it's valid remote coupon. it's added cart , reflected in total normal wc coupon.

the issue arises when want update coupon (e.g., increase usage count, decrease balance) when order placed. right using woocommerce_order_status_processing. triggered late , when redeeming coupon fails, order placed anyway (even though throw exception).

what need payment , coupon redeeming atomic process. biggest problem right people can place orders invalid coupon codes (again, these not wc coupons!).

p.s. coupons cannot added cart if they're invalid. issues arises when adds valid coupon 2 carts, places order each card -- second order may have refused here.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -