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!


(based on 25 Reviews)
How to Add Custom Field in Address Form in Magento 2Author Magento Badge

Sanjay Jethva

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.


Leave a Reply

Your email address will not be published.