Magento 2: How to set custom template for core block
Just reference necessary block and set template as attribute of referenceBlock
node:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer_form_register" template="VendorName_ModuleName::form/register.phtml"/>
</body>
</page>
Alternative syntax:
<referenceBlock name="customer_form_register">
<action method="setTemplate">
<argument name="template" xsi:type="string">VendorName_ModuleName::form/register.phtml</argument>
</action>
</referenceBlock>
Also if you are using Enterprise Edition, make sure to put Magento_CustomerCustomAttributes
to sequence
in your module.xml
because it also overrides this template and may override your changes.