I have WooCommerce site in which our users can subscribe to a monthly pack of goodies. Sometimes we give our new users discount coupons (first 3 months -25% off etc.). Users can modify the content of their subscription through My Account page and also renew the order early by clicking on “Send now” button.
The issues I’ve been having are connected to the coupons. We have had a lot of clients complaining that after they have modified their order and/or asked the subscription to be sent early to them, the coupon does not apply on the checkout view, saying the coupon is worth “-0,00 €”.
In the other case where users modify their subscription contents (through a custom Vue script I’ve yet to delve deeper into) and sometimes the coupon gets dropped out as well. I have had trouble recreating this issue on my end, but it does happen with our clients and even our staff who try to modify their subscription contents.
I did some debugging on my staging environment and tried to force the coupon back into my test order but every time I got an error from WooCommerce telling me that the coupon (first 3 months -20% off) is only viable with new orders. Then I made a function that created (or at least, tried) a new subscription order by copying the contents (products, shipping, coupons) of the current order into a new order but that did not help me either as I got the same error telling me that the coupon is only viable with new orders.
I also tried to bypass the coupon restrictions with some custom code that would let me apply any coupon to any order despite of their original restrictions (that I generated through ChatGPT), but it didn’t work either.
The coupon admin view on WooCommerce doesn’t seem to have any setting related to these restrictions so I’ve been trying to bypass them programmatically.
laku_boy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.