1

I want to show both the billing address and shipping address form in a user-registration page and save the data .

0

display address fields using customer_account_create.xml as below:

<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>

In template file already value set as 1 for both default_billing and default_shipping fields as 1, so by default billing and shipping, both addresses got to save the as same address.

vendor/magento/module-customer/view/frontend/templates/form/register.phtml

<input type="hidden" name="default_billing" value="1">
<input type="hidden" name="default_shipping" value="1">
| improve this answer | |
  • here I can only save one address the address as default billing and default shipping i want two forms that one store as default billing and another one default shipping – jithin Feb 20 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.