How to add a custom field to customer address in Magento 2?
With the Address Field Manager module, it is possible to create custom address fields.
Go to Swissup - Address Field Manager menu and click on Add New Field button.
Then follow the steps.
Field Properties tab
- In the Default Label field, specify the name for the new address field.
- In the Input Type dropdown choose the type of entering the information for the new address field. Available values are Text Field, Text Area, Date, Yes/No, Multiple Select, Dropdown.
- In the Values Required field, select Yes to inform users that the field must be filled.
Storefront Properties tab
- In the Show on Storefront field, select Yes to enable the display of the new custom field in the billing and shipping address of one page checkout in Magento 2.
- In the Sort Order field, specify a sort order for the field display.
- In the Show in Forms field, specify your store forms where you want to show the field. Thereby the custom address fields can be visible in the:
- Order View page
- Edit Customer form
- Create Order form
- Customer Address Registration form
- Billing & Shipping forms on the checkout page
- Customer Account
Advanced Field Properties tab
- In the Attribute Code field, you don't have to make any changes.
- In the Default Value field, you can specify the value for the new address field that will be shown by default.