In my custom theme, I added custom template for which I am getting invalid template file error in system.log. My xml file loctaion:


My template file location



<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="product.info.details">
<block class="Magento\Catalog\Block\Product\View\Description" name="size_guide" template="Magento_Catalog::product/view/size_guide.phtml" group="detailed_info">
    <argument name="title" translate="true" xsi:type="string">Size Guide</argument>
<!-- this is code to add new tab end -->


<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('size_guide')->toHtml(); ?>

Magento looks for the template file in module-catalog and gives the error when not found. Why does Magento not pick up the template file from my theme?

4 Answers 4


place your size_guide.phtml in your module i.e {code}/{vendor}/{module}/view/frontend/templates/product/view/size_guide.phtml it worked for me.

  • i have placed the template file as app/code/Magento/Catalog/view/frontend/templates/product/view/size_guide.phtml. Still its not working?
    – azam
    Mar 22, 2016 at 14:55
  • than check your xml file. i think you are not calling template file properly...otherwise share the files we will check. Mar 23, 2016 at 3:45
  • i have given my xml file contents above, i am calling the template file as: Magento_Catalog::product/view/size_guide.phtml.
    – azam
    Mar 23, 2016 at 6:41
  • remove Magento_Catalog and give your module name. Mar 23, 2016 at 8:25
  • you mean removing Magento_Catalog from app/design/frontend/myvendor/mytheme/ and create new module there, placing my xml file like app/design/frontend/myvendor/mytheme/mymodule/layout/? if so then should i keep the template file as app/code/Magento/Catalog/view/frontend/templates/product/view/size_guide.phtml?
    – azam
    Mar 23, 2016 at 8:36

This is probably because the name of the module is not is proper case.

When creating the folder structure,


replace the Magento_catalog with Magento_Catalog. That will direct Magento to pick up the proper template.


Your size_,guide.phtml file is need to store in app/design/vendor/theme/frontend/Magento_Catalog/templates/size_guide.phtml

Because, you had used default module name Magento_Catalog that's why you can't store in app/code.


Since you are overriding the catalog_product_view.xml in your theme, you have to create the folders override/base inside your layout folder. Hence your layout file path should be like the following


Now run the setup upgrade command and refresh. This has worked for me.

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.