Magento – How to i edit default Magento 2 New Products widget template

magento2

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?

Best Answer

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.