I want to add country-state functionality to the customer registration form and how to save it
-
There already is the country and the state (according to the selected country) on the customer address. Are you sure you need to duplicate this fields on the customer entity ?– CladiussCommented Jun 2, 2023 at 7:17
-
yes, but in frontend side– Pruthvi RavalCommented Jun 2, 2023 at 8:01
Add a comment
|
1 Answer
Add below code in your customer_account_create.xml file. This Will add all Address Fields in Registration Form in 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>
-
then how to get this value as a customer attribute for add field in customer account information in admin side? Commented Jun 5, 2023 at 9:05
-
I want to add functionality for a country region in the customer account information section Commented Jun 5, 2023 at 9:07
-
You can't access this value as a customer attribute. You have to access these values as simply Magento did for accessing address values. Commented Jun 6, 2023 at 7:48
-
-
using XML file without overriding phtml file is possible? Commented Aug 7, 2023 at 6:46