Magento – Magento 2 override template problem

magento2overridestemplate

I need to override a template file \Magento\Customer\view\frontend\templates\form\register.phtml in my custom module.

According to Magento's document. I know that creating a custom theme module can fit my need, but I want to know other than creating a custom theme module, are there some other methods for overriding a template file?

Thanks in advance.

Best Answer

You have to override the customer module to customize the register template. You have to create the new custom module and inside that module's etc/module.xml file, you have to set:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Package_Module" setup_version="2.0.1">
        <sequence>
            <module name="Magento_Customer"/>
        </sequence>
    </module>
</config>
Related Topic