0

I am trying to override a core phtml file following the advice in this question How to override .phtml files in Magento 2. I am not able to get it to work and I am wondering in general how the path of the override file is determined so I can know if I am putting it in the correct location. For example, I am overriding the file

vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml

and I am not quite sure if the right path would be

app/design/frontend/MyCompany/MyTheme/Magento_Catalog/view/base/templates/product/price/amount/default.phtml

or

app/design/frontend/MyCompany/MyTheme/Magento_Catalog/templates/product/default.phtml.

My intuition goes with the second choice since the directories templates and product are already present while the view and everything after in the first choice are not. I have not been able to get either to work and I am wondering which one is correct or if it is supposed to be a third location.

1 Answer 1

0

Leaving aside the typo in the module name (Magento_Catalog), this second solution should be: app/design/frontend/MyCompany/MyTheme/Magneto_Catalog/templates/product/price/amount/default.phtml

3
  • Thank you for your answer. What I did was copy the original to this location, add a php echo test statement, run bin/magento setup:upgrade, and then cleared the cache and refreshed the page. Do you have any ideas about what would cause changes not to appear? Commented Jan 11, 2024 at 22:44
  • Sorry, it should be like: app/design/frontend/MyCompany/MyTheme/Magneto_Catalog/templates/product/price/amount/default.phtml Commented Jan 11, 2024 at 22:46
  • Thanks, it worked. Commented Jan 11, 2024 at 22:50

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.