Sometimes in Magento, the coupon codes that you set up stop working for no reason. There’s an error message saying “Coupon code xxx is not valid”. Our guide will provide several solutions to help you get your coupon codes working again.
How to Solve “Coupon code is not valid” Error
Disable Discard subsequent rules
Log into your Magento backend. Go to Marketing > Promotions > Cart Price Rules.
- Under the Rule Information section, check Customer Groups to see if it is set correctly, or even been set at all. Normally you will want to enable it for “NOT LOGGED IN” customers. You can also try to enable it for all of the customer groups to see if the problem is still there. If after enabling all customer groups the problem still persists, move on to the next steps.
- Under Conditions section, see if any condition exist. If there is any, check the logic to see if it prevents the coupon code from being applied.
- Under Actions section, notice the Discard subsequent rules. If it is set to Yes then it is preventing other coupon codes from being applied. You may want to set it to No. Notice that this does not stop the current coupon code from happening, but other coupon codes. So if you are having problem on your current coupon code, you may want to check your other coupon codes and set Discard subsequent rules for all of them to No.
Edit expiration date
If you’re using an older version of Magento (< 2.4.x), chances are this is an issue with the way that you set your coupon code’s expiration date. When the expiration date is set too high (> 20 years), it actually results in a reproducible bug which prevents your coupon code from being applied.
To get around this, you’ll need to reduce your expiration date to a more sensible period, preferably less than 20 years difference between the From and the To fields.
formkey to your coupon template
formkey is added in Magento 2.2.9 and it’s possible that your current coupon template lacks this block. To add
formkey into your coupon template, you’ll first need to navigate to:
and inside the <form> element you’ll want to add:
<?= $block->getBlockHtml('formkey'); ?>
After this, reindex and clear your cache using:
php bin/magento indexer:reindex php bin/magento cache:flush
And check if the issue is resolved for you.
I’ve tried all of these things, applied to all customer groups, only condition is orders vale >15 and discard subsequent rules is turned to yes. When testing on a basket of £20 continues to say, Coupon Code not valid. Please Help!
Hi Alice. Do you have any other active coupon codes? If you do, check if any of them have the Discard Subsequent Rules option on Yes, because they may stop your testing coupon code from processing. Try turning Discard Subsequent Rules of all of them into No.
Hope that helps!
Cant seem to get a code to work when a reorder is placed through a users past orders in account. Any ideas?
I have only 1 coupon code and I cannot seem to get it to work.
I am trying to give free shipping for products in a specific category, to anywhere within a certain province.
I followed this exactly and it doesn’t seem to work.
I get the error code “The coupon code “berettaday” is not valid.”
Thank you! The first solution helped me.
Great to hear that, Lindsey! 🙂