0

In Magento2, how to override the following template?

/vendor/magento/module-ui/view/frontend/web/template/messages.html

I found the answer Better Checkout Error Message Magento 2 and I copied it to the following place like the answer suggests:

/app/design/frontend/[YourPackage]/default/Magento_Ui/web/template/messages.html

but it is not overridden.

But the following another template under module-theme can be overridden by copying it to the following location.

/vendor/magento/module-theme/view/frontend/templates/messages.phtml

to

/app/design/frontend/[YourPackage]/default/Magento_Theme/templates/messages.phtml

I also executed the following command but nothing changed:

bin/magento setup:upgrade
bin/magento setup:static-content:deploy

1 Answer 1

1

You did perfectly.

just make sure there are no any 3rd party or cloudfare cache applied on your website.

If applied then please do flush/purge it.

3
  • Thank you! I don't have much knowledge about our magento2 project or magento2 itself. But I have to quickly modify the file. Maybe something is cached or the file is not the file I'm trying to modify. Which directory or files or configs should I check to check if something is cached? And, is there an easy way to identify the files which are used in a specific page?
    – user_
    Commented Jan 13, 2022 at 13:50
  • Please run php bin/magento cache:flush and check in private window. Commented Jan 13, 2022 at 15:06
  • thank you. cache:flush was already executed. it seems i'm overriding a wrong template. i gave up overriding or finding it. but it was very helpful to know that i did perfectly.
    – user_
    Commented Jan 21, 2022 at 3:38

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.