2

I am new to magento development can you help me how to override grid.phtml which resides in

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

I need to customize this template from my module. but i am not understand how to override this file, where to put and all.

1

You can replace the grid.phtml where you call the widget like below

{{widget type="Magento\CatalogWidget\Block\Product\ProductsList" title="Our Products" products_count="8" template="Namespace_Modulename::product/widget/content/grid.phtml"}}

Reference: Magento2: How to override widget template

Edit:

You can override this template by coping grid.phtml file in below path.

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

Hope it helps!!!

  • where i can put this code – Dev Sep 14 at 10:57
  • Where you call your widget in Magento Admin. – Sumit Sep 14 at 11:00
  • is there any way i can override this programatically? – Dev Sep 14 at 11:01
  • You can do it on theme level. Please check my updated answer. – Sumit Sep 14 at 11:03
  • is this work on cutom module/themes? – Dev Sep 14 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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