Friday, 6 December 2019

How to show address field in registration form in magento 2?

Hi first find magento root folder then vendor\magento\module-customer\view\frontend\layout customer_account_create.xml.
Then copy the file and related theme folder. For example path /app/design/frontend/vendor name /Theme Name/Magento_Customer/layout/customer_account_create.xml
then go to line no 13 check this code and put billow section on line no


 <referenceContainer name="content">
            <block class="Magento\Customer\Block\Form\Register" name="customer_form_register" template="form/register.phtml">
                <container name="form.additional.info" as="form_additional_info"/>
                <container name="customer.form.register.fields.before" as="form_fields_before" label="Form Fields Before" htmlTag="div" htmlClass="customer-form-before"/>
                <action method="setShowAddressFields">
                    <argument name="show.address.fields" xsi:type="boolean">true</argument>
                </action>
            </block>
            <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
                <arguments>
                    <argument name="triggers" xsi:type="array">
                        <item name="registerSubmitButton" xsi:type="string">.action.submit</item>
                    </argument>
                </arguments>
            </block>
        </referenceContainer>

No comments:

Post a Comment