I need to override the widget template file /vendor/magento/module-catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml but in xml file the phtml file was not mentioned at any where except on /etc folder.

<parameter name="template" xsi:type="select" required="true" visible="true">
    <label translate="true">Template</label>
        <option name="default" value="product/widget/new/content/new_grid.phtml" selected="true">
            <label translate="true">New Products Grid Template</label>

How can I override the vendor-widget-phtml file new_grid.phtml to my custom module.

1 Answer 1


this way i get changes of phtml by my custom module


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">

    <preference for="Magento\Catalog\Block\Product\Widget\NewWidget" type="MyModule\WidgetOverride\Block\Product\Widget\NewWidget" />



namespace MyModule\WidgetOverride\Block\Product\Widget;

class NewWidget extends \Magento\Catalog\Block\Product\Widget\NewWidget
  protected function _construct()

now add your phtml file this path app/code/VendorName/ModuleName/view/frontend/templates/product/widget/new/content/new_grid.phtml

frontend shows my changes on product page by override phtml file

enter image description here hope this help you :) Happy coding.

  • I have tried this but still the changes I'm doing in the phtml is not showing on frontend.
    – Siv
    Oct 22, 2020 at 6:55
  • Thanks. I will check and update you
    – Siv
    Oct 22, 2020 at 11:33
  • I did try your code but still the update is not showing in frontend.
    – Siv
    Oct 23, 2020 at 13:22
  • yes I have ran all the commands
    – Siv
    Oct 23, 2020 at 16:11
  • 1
    Hi @Siva sorry for late response, plz check updated answer, last time we override wrong block file :) this override done new_grid.phtml. Oct 26, 2020 at 15:32

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.