How to Override a Customer Module Widget Templates in Magento 2 using Plugin

If you are building a module and you encounter a block that cannot be referenced by name then you probably need to create a plugin to overwrite the template. This can be achieved in three simple steps.

STEP 1 :

Copy telephone.phtml template to your custom module (in my case it’s Bajaj_Customer)




Do the changes according to your need.

STEP 2 :

Now we need to create a Plugin class.


STEP 3 :

Update di.xml 



Similarly you can override any templates defined in the widget folder.



Thank you 🙏 !