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
Post a Comment