How to Add Custom Field in Address Form in Magento 2

How to Add Custom Field in Address Form in Magento 2

Magento 2 is a widely used platform by various types of businesses. Hence, the checkout page, shipping or billing page may not be the same as the default Magento 2 for every store. According to the business requirement, the address forms may vary.

For example, implementing the Indian GST tax in Magento 2 store requires to add Buyer GST number field in the checkout form. It is a custom field that needs to be programmatically added to get buyer GSTIN from the customers. Here. I’ll show how to add custom field in address form in Magento 2.

Method to Add Custom Field in Address Form in Magento 2:

  1. Create registration.php file in app\code\[Vendor]\[Namespace]\
  2. Create module.xml file in app\code\[Vendor]\[Namespace]\etc
  3. Create di.xml file in app\code\[Vendor]\[Namespace]\etc
  4. Create LayoutProcessor.php in [Vendor]\[Namespace]\Plugin\Checkout\Model

With the above method, you can add as many custom fields you want in the address form in Magento 2.

Feel free to mention your doubts in the Comments section below and I’d be happy to help!

Thanks!

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

4.6
(based on 16 Reviews)

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

5 comments On How to Add Custom Field in Address Form in Magento 2

Leave a reply:

Your email address will not be published.