plugins – WooCommerce reset coupon usage for user
I am learning to develop with WooCommerce and I have a blocker that is driving me crazy.
I am experimenting by adding a coupon defined in marketing -> coupons to the cart, only when it’s the birthday of the current user.
Until here everything is ok.
The problem will come, for example, next year if I want to apply the same coupon again on the user’s birthday.
I will not be allowed to do so, because I set up the maximum usage to 1, to avoid any coupon spam.
I have dug in the Db and found different tables having info about the coupon:
- woocommerce_order_itemmeta
- woocommerce_order_items
- wc_order_coupon_lookup
I tried to modify the data in the above-mentioned tables, especially in woocommerce_order_itemmeta since I can see a record named coupon_data in the meta_key column, but no luck until now.
Do any of you know an effective method to reset the usage for a certain user after it reached the limit for a specific coupon?
I have been looking online and the only solution I found was involving deleting the order, which is not a good option.
Leave an answer