[Solved] Magento 2 “Coupon code is not valid” Error

the promotional code you entered is not valid

Promotional code is an effective way to encourage shoppers to spend more as well as to retain their loyalty to your business. However, sometimes the codes stop working for no reason. An error message may pop up with “Coupon code is not valid” in Magento 2.

There are 3 ways you can follow to make the coupon codes work again. Follow this guide to boost your business revenues successfully.

Edit Expiration Date

For those using an older Magento version (< 2.4.x), the issue may originate from the way the coupon code’s expiration date is set. If the expiration date is set higher than 20 years, then a reproducible bug will prevent the codes from being applied in the system. This is why you’ll see the message saying the coupon code isn’t valid.

It’s easy to fix this as you can adjust the code’s expiration date to a closer time of fewer than 20 years of difference.

Disable Discard Subsequent Rules

Step 1: From the Admin panel, navigate Marketing > Promotions > Pricing Cart Rules.

Step 2: Check the following sections:

  • Rule Information

Check if the settings for Customer Groups are correct. You will want to enable it for “NOT LOGGED IN” customers. Or you can try to enable it for all customer groups to see if the problem is solved.

  • Conditions
coupon code conditions

In this section, check for existing conditions that may prevent the use of the code.

  • Actions
the promotional code you entered is not valid

See if the Discard Subsequent Rules is set to active. It’s best to set it to No. While it doesn’t block the current coupon code, it will stop other ones.

Configure The Coupon Template

In case your coupon template doesn’t have the formkey block, it also causes the bug of invalid coupon code.

Step 1: Find the template using

vendor/magento/YOUR_THEME/Magento_Checkout/templates/cart/coupon.phtml

Step 2: Add the code inside the <form> element:

<?= $block->getBlockHtml('formkey'); ?>

Step 3: Reindex and clear cache with this command line:

php bin/magento indexer:reindex 
php bin/magento cache:flush

Step 4: Check if the coupon code can be applied now.

Conclusion

By following these methods, you can debug the “The promotional code you entered is not valid” error. As mentioned, promotional codes are handy to attract customers, so you need to ensure that customers can smoothly apply the code when they want to check out their cart.

Related Posts:

[Solved] Magento 2 Admin 404 Not Found Error – How to Fix It

How To Change The Logo In Magento 2? (5 minutes)

How To Change Add To Cart Button’s Text And Link In Magento 2?