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:

  1. woocommerce_order_itemmeta
  2. woocommerce_order_items
  3. 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.

Tom J Nowell 2 months 2022-12-13T09:09:05-05:00 0 Answers 0 views 0

Leave an answer