How to Override Custom Module PHTML by Another Custom Module – Magento 2

layoutmagento2overridesphtml

I've a malfunctioning module that needs to be overwritten in some parts. I would like to create a custom module that fixes that module instead of making changes in a theme as suggested in magento docs. The problem is that I'd rather keep my fixing module next to bad one so I can easily reuse it in another projects.

Another way is to remove malfunctioning phtml by layout.xml in a custom (fixing) module and replace that file with one of my own.

Which way is better and should be performed in cases like mine?

Best Answer

Simplest way to override phtml template using Custom module. just add sequence into module.xml and then override your layout with template.

That set.

And if you want to override it using theme then just copy layout xml file & set your template path to that file with block and append in it.

Related Topic