0

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?

Thanks

2 Answers 2

1

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

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

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

7
  • For overwrite layout needs to use override/base. Please see my answer. Commented 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
    Commented 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
    Commented 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! Commented Jun 15, 2022 at 12:57
  • @VictorTihonchuk Yes, you can remove downvote and edit your answer.
    – Msquare
    Commented Jun 15, 2022 at 13:11

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.