cancel
Showing results for 
Search instead for 
Did you mean: 

Change the registration page address information to non-required or delete some fields

Change the registration page address information to non-required or delete some fields

I have displayed the address information on the registration page. Now I want to change all of these required items to non-required. How to change it, or how to delete the Street Address, City, State/Province, Zip fields. Can anyone help me solve this problem? thank you very much

3 REPLIES 3

Re: Change the registration page address information to non-required or delete some fields

Hello @allenlai 

 

If you want to make any changes in registration form, You can simply override default register.phtml

Firstly add the below code in your layout file app/design/frontend/theme_dir/theme_name/layout/custom.xml 

<customer_account_create>
        <reference name="customer_form_register">
            <action method="setTemplate">
                <template>custom/persistent/customer/form/register.phtml</template>
            </action>
        </reference>
</customer_account_create>

After this overide register.phtml 

From path :

app/design/frontend/base/default/template/persistent/customer/form/register.phtml

To path :

app/design/frontend/theme_dir/theme_name/template/custom/persistent/customer/form/register.phtml

 

And here you can make changes related to delete the Street Address, City, State/Province, Zip fields or remove required field option.

 

If my answer is useful, please Accept as Solution & give Kudos.

Re: Change the registration page address information to non-required or delete some fields

I understand yours, I am also doing this, but now remove the Street Address, City, State/Province, Zip fields directly in the register.phtml file will still be verified, how to solve this?

Re: Change the registration page address information to non-required or delete some fields

Hello @allenlai ,

 

Below way you can display address fields using customer_account_create.xml:

<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">
            <arguments>
                <argument name="show_address_fields" xsi:type="boolean">true</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

otherwise, you can use an extension for it https://github.com/karliuka/m2.ShowAddressFields

 

--
If my answer is useful, please Accept as Solution & give Kudos