In this post I am going to explain how to override registration page template (register.phtml) in magento 2.
Here, I am using my custom module – Ht_Mymodule
First create xml file customer_account_create.xml and add below code snippet.
File Path: app/code/Ht/Mymodule/view/frontend/layout/customer_account_create.xml
<?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">
<action method="setTemplate">
<argument name="template" xsi:type="string">Ht_Mymodule::form/register.phtml</argument>
</action>
</referenceBlock>
</body>
</page>Now add register.phtml file on below path.
File Path: app/code/Ht/Mymodule/view/frontend/templates/form/register.phtml
You can copy register.phtml file from Magento 2 default files and then write your changes.
You can find Magento 2 default register.phtml at below location.
vendor/magento/module-customer/view/frontend/templates/form/register.phtml
Thats it. Enjoy Magento 2!!
Write an article about ecommerce that help people to grow their ecommerce business. You’ll find best ecommerce guide, news, tips & more!


Leave a Reply