1

I want to edit default Magento 2 New Products Grid widget content:

The file located here:

vendor/magento/module-catalog/view/frontend/templates/product/widget/new/content

But when I'm done with editing its going removed on every update.

So how can I edit on my own temlpate?

0

copy these files ( or what ever template you want to change ) to your theme directory and change it. the file location would be :

Your-Package/Your-theme/Magento_Catalog/templates/product/widget/

Remember :

you can override any template by copying that file to your theme package. However, you need to take care some naming convention and path of files i.e

1 - if there is vendor module naming "module-catalog" it will become Magento_Catalog in your theme folder and if there is module in vendor "module-grouped-product" it will become Magento_GroupedProduct ( - will be removed and first letter will be become upper case )

2 - All your templates will be placed in templates folder and layout folders like ( Magento_Catalog/tempates , Magento_Catalog/layout ) there will not be any view and frontend folders.

3
  • I have done it and changed the code to {{widget type="Magento\Catalog\Block\Product\Widget\NewWidget" display_type="all_products" show_pager="0" products_count="4" template="Xx/xx/Magento_Catalog/templates/product/widget/new/content/new_grid.phtml"}} but it's not working. – Efex Apr 10 '18 at 15:11
  • it will not work like that, you also need to compile and deploy static content again – Naveed Asim Apr 10 '18 at 15:18
  • Also, you would need to make some changes in widget.xml to to effect your changes, did you check this post ? magento.stackexchange.com/questions/162950/… – Naveed Asim Apr 10 '18 at 15:19

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.