Add Custom Field in customer registration frontend side form

To add address and country fields on the frontend custom form

Add the below code in your customer_account_create.xml file. This Will add all Address Fields in the Registration Form in the frontend only


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

Leave a comment

Your email address will not be published. Required fields are marked *