5

I am trying to override the the catalog widget template found in this directory:

/vendor/magento/module-catalog-widget/view/frontend/templates/product/widget/content/grid.phtml

I copied the grid.phtml file to:

mytheme/Magento_Catalog_Widget/templates/product/widget/content/grid.phtml

But this hasn't worked and the widget I have put on my page is still pulling in the default template. Any ideas? I am pretty sure I am using the right directory as all other template files I have overridden have worked fine. Tried flushing the cache and no joy.

I noticed the code the wysiwyg generates for the widget on the page references a template file. I presume this is still overridden?

{{widget type="Magento\CatalogWidget\Block\Product\ProductsList" products_count="4" template="product/widget/content/grid.phtml" conditions_encoded="a:2:[i:1;a:4:[s:4:`type`;s:50:`Magento|CatalogWidget|Model|Rule|Condition|Combine`;s:10:`aggregator`;s:3:`all`;s:5:`value`;s:1:`1`;s:9:`new_child`;s:0:``;]s:4:`1--1`;a:4:[s:4:`type`;s:50:`Magento|CatalogWidget|Model|Rule|Condition|Product`;s:9:`attribute`;s:12:`category_ids`;s:8:`operator`;s:2:`==`;s:5:`value`;s:2:`32`;]]"}}

2 Answers 2

18

You have to just rename your theme module directory like Magento_CatalogWidget.

New file path for your theme: mytheme/Magento_CatalogWidget/templates/product/widget/content/grid.phtml

When core module name with - you have to remove that and make the next character Uppercase.

Eg.: if you want to override core module module-catalog-inventory then your path would be Magento_CatalogInventory.

3
  • 1
    Excellent thank you @Rakesh that has worked. I didn't know you had to remove the second '-' Commented May 6, 2016 at 13:42
  • 1
    Example path should be Magento_CatalogInventory.
    – Michael
    Commented Oct 27, 2016 at 14:52
  • You can find the module name Magento_CatalogInventory inside the registration.php file in the module. This is the definitive way to name the module within your theme. Commented Jul 10, 2018 at 18:29
0

New Path should be the following:

theme/Magento_CatalogWidget/web/template/product/widget/content/grid.phtml

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.