1

I just need to find where to change the 'This Coupon is not valid' message. I want to make it a bit more informative - "This Coupon is not valid. Please make sure you have registered an account, or that the coupon code is correct". I can find the coupon success message, but not this one.

Any pointers would be gratefully received. TIA

3
  • Override this controller function and change your desired message vendor/magento/module-checkout/Controller/Cart/CouponPost.php
    – Dotsquares
    May 9, 2022 at 9:03
  • Try with en_US.csv "The coupon code ""%1"" is not valid.","The coupon code ""%1"" is not valid."
    – S.P
    May 9, 2022 at 10:01
  • vendor/magento/module-checkout/i18n/en_US.csv , update there and execute setup upgrade and deployment command for render changes in static file.
    – S.P
    May 9, 2022 at 10:02

1 Answer 1

1

Magento check coupon code in vendor/magento/module-checkout/Controller/Cart/CouponPost.php

$this->messageManager->addErrorMessage(
                            __(
                                'The coupon code "%1" is not valid.',
                                $escaper->escapeHtml($couponCode)
                            )
                        );

And Magento translate coupon error message in en_US.csv.

vendor/magento/module-checkout/i18n/en_US.csv

Line num: 20

"The coupon code ""%1"" is not valid.","The coupon code ""%1"" is not valid."
1
  • Thank you all. I added the new line in the translate csv. That did the trick.
    – Andy
    May 16, 2022 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.