I am trying to override app/code/Mageants/SampleProduct/view/frontend/layout/catalog_product_view.xml in my theme. I copied it to app/design/frontend/Smartwave/porto_child/Mageants_SampleProduct/layout/catalog_product_view.xml, made some changes, and redeployed and cleared the cache.

This is not working. I also tried with a template file which worked without any problems, only the XML is making trouble. Any ideas about what I am doing wrong?


2 Answers 2


If you want to overwrite layout the path must be app/design/frontend/Smartwave/porto_child/Mageants_SampleProduct/layout/override/base/catalog_product_view.xml

Reference: Override a layout

  • If you want override a layout of a specific theme, for example: ../layout/override/theme/Magento/luma/catalog_product_view.xml Mar 10 at 10:33

First, check if It may be already overwritten in app/design/frontend/Smartwave/porto_child/Magento_Catalog/layout/catalog_product_view.xml or not.

IF not overwrite then add your code into app/design/frontend/Smartwave/porto_child/Magento_Catalog/layout/catalog_product_view.xml

IF overwrite then update your code into the existing app/design/frontend/Smartwave/porto_child/Magento_Catalog/layout/catalog_product_view.xml

  • For overwrite layout needs to use override/base. Please see my answer. Jun 15, 2022 at 11:43
  • @VictorTihonchuk Please read the doc proper if you want to override base layouts then you use override/base.
    – Msquare
    Jun 15, 2022 at 12:41
  • @VictorTihonchuk And by the way, the vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml file is not in the base folder. Please check and remove the vote-down. devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/…
    – Msquare
    Jun 15, 2022 at 12:45
  • 1
    Sorry for downvote, looks like I've misunderstood the your idea of answer. Please make any changes (edit) to answer for allow me to remove downvote. But anyway, in theme Magento_Catalog/layout/catalog_product_view.xml - extends layout, not overwrite! Jun 15, 2022 at 12:57
  • @VictorTihonchuk Yes, you can remove downvote and edit your answer.
    – Msquare
    Jun 15, 2022 at 13:11

Your Answer

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

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