How can I add custom attribute to customer address book in Magento 2

Magento 2 provides some default attributes to show in the customer address book. But, sometimes we need to add additional information/custom attributes in the customer address book. In this case, we can modify the address book. So, in this blog, we will learn how to add a custom customer address attribute in the customer address book.

Step 1.

You must have a custom attribute made.

Then copy book.phtml from vendor/magento/module-customer/view/frontend/templates/address/book.phtml and paste it in app/design/frontend/{Vendor}/{Theme}/Magento_Customer/templates/address/book.phtml

or, You can copy and paste below code.


Step 2.

After copy and paste, You have to add the below code on top of the HTML code.

Like this,

Step 3.

Now, You have to add the below code at lines no 23 and 55.

Step 4.

Finally, You can check your custom attribute after the phone number on the customer address book page.

Magento 2 custom attribute in customer address book


Leave a Reply