{"id":364550,"date":"2023-01-17T11:27:51","date_gmt":"2023-01-17T11:27:51","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=364550"},"modified":"2023-12-13T13:30:27","modified_gmt":"2023-12-13T13:30:27","slug":"how-to-create-customer-address-field-in-magento2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/","title":{"rendered":"How to create customer address field in Magento 2"},"content":{"rendered":"\n<p>Sometimes we need to get more information of the customer such as GST number, alternate mobile number etc. We can get the extra information of the customer.<\/p>\n\n\n\n<p>Here we will follow the webkul sample module <a href=\"https:\/\/webkul.com\/blog\/create-hello-module-in-magento2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 hello world extension<\/a><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>We need to create customer address attribute with the help of patch at app\/code\/Webkul\/Hello\/Setup\/Patch\/Data\/GstAttribute.php<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Webkul\\Hello\\Setup\\Patch\\Data;\n\nuse Magento\\Framework\\Setup\\Patch\\DataPatchInterface;\nuse Magento\\Framework\\Setup\\ModuleDataSetupInterface;\nuse Magento\\Eav\\Setup\\EavSetupFactory;\nuse Magento\\Catalog\\Model\\Product;\nuse Magento\\Customer\\Api\\AddressMetadataInterface;\nuse Magento\\Eav\\Model\\Config as EavConfig;\nuse Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price;\nuse Magento\\Customer\\Setup\\CustomerSetupFactory;\nuse Magento\\Customer\\Model\\Customer;\nuse Magento\\Eav\\Model\\Entity\\Attribute\\SetFactory as AttributeSetFactory;\n\nclass GstAttribute implements DataPatchInterface\n{\n    \/**\n     * GSTIN Attribute Code\n     *\/\n    public const GSTIN_CODE = &#039;wkgstin&#039;;\n\n    \/**\n     * @var EavSetupFactory\n     *\/\n    private $eavSetupFactory;\n\n    \/**\n     * @var ModuleDataSetupInterface\n     *\/\n    private $moduleDataSetup;\n\n    \/**\n     * EAV Config data.\n     *\n     * @var EavConfig\n     *\/\n    private $eavConfig;\n\n    \/**\n     * @var CustomerSetupFactory\n     *\/\n    protected $customerSetupFactory;\n\n    \/**\n     * @var AttributeSetFactory\n     *\/\n    private $attributeSetFactory;\n\n    \/**\n     * Constructor Initialize\n     *\n     * @param EavSetupFactory $eavSetupFactory\n     * @param EavConfig $eavConfig\n     * @param CustomerSetupFactory $customerSetupFactory\n     * @param ModuleDataSetupInterface $moduleDataSetup\n     * @param AttributeSetFactory $attributeSetFactory\n     * @return void\n     *\/\n    public function __construct(\n        EavSetupFactory $eavSetupFactory,\n        EavConfig $eavConfig,\n        CustomerSetupFactory $customerSetupFactory,\n        ModuleDataSetupInterface $moduleDataSetup,\n        AttributeSetFactory $attributeSetFactory\n    ) {\n        $this-&gt;eavConfig = $eavConfig;\n        $this-&gt;eavSetupFactory = $eavSetupFactory;\n        $this-&gt;customerSetupFactory = $customerSetupFactory;\n        $this-&gt;moduleDataSetup = $moduleDataSetup;\n        $this-&gt;attributeSetFactory = $attributeSetFactory;\n    }\n\n    \/**\n     * Do Upgrade\n     *\n     * @return void\n     *\/\n    public function apply()\n    {\n        $eavSetup = $this-&gt;eavSetupFactory-&gt;create(&#091;&#039;setup&#039; =&gt; $this-&gt;moduleDataSetup]);\n\n        \/* Create GSTIN Attribute *\/\n        $eavSetup-&gt;addAttribute(\n            AddressMetadataInterface::ENTITY_TYPE_ADDRESS,\n            self::GSTIN_CODE,\n            &#091;\n                &#039;label&#039; =&gt; &#039;GST No&#039;,\n                &#039;input&#039; =&gt; &#039;text&#039;,\n                &#039;visible&#039; =&gt; true,\n                &#039;required&#039; =&gt; false,\n                &#039;position&#039; =&gt; 200,\n                &#039;sort_order&#039; =&gt; 200,\n                &#039;system&#039; =&gt; false\n            ]\n        );\n\n        $gstAttribute = $this-&gt;eavConfig-&gt;getAttribute(\n            AddressMetadataInterface::ENTITY_TYPE_ADDRESS,\n            self::GSTIN_CODE\n        );\n\n        $gstAttribute-&gt;setData(\n            &#039;used_in_forms&#039;,\n            &#091;&#039;adminhtml_customer_address&#039;, &#039;customer_address_edit&#039;, &#039;customer_register_address&#039;]\n        );\n        $gstAttribute-&gt;save();\n    }\n    \/**\n     * Get aliases\n     *\n     * @return void\n     *\/\n    public function getAliases()\n    {\n        return &#091;];\n    }\n\n    \/**\n     * Get dependencies\n     *\n     * @return void\n     *\/\n    public static function getDependencies()\n    {\n        return &#091;];\n    }\n}<\/pre>\n\n\n\n<p>2) Now we need to register a plugin for adding field in customer address form at customer end. <br>app\/code\/Webkul\/Hello\/etc\/di.xml<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:ObjectManager\/etc\/config.xsd&quot;&gt;\n    &lt;type name=&quot;Magento\\Customer\\Block\\Address\\Edit&quot;&gt;\n        &lt;plugin name=&quot;wkgst_address_gstin&quot; type=&quot;Webkul\\Hello\\Plugin\\Customer\\AddressEdit&quot; sortOrder=&quot;2&quot;\/&gt;\n    &lt;\/type&gt;\n&lt;type name=&quot;Magento\\Checkout\\Model\\ShippingInformationManagement&quot;&gt;\n        &lt;plugin name=&quot;save_to_quote_table&quot; type=&quot;Webkul\\Hello\\Plugin\\Checkout\\Model\\ShippingInformationManagement&quot; sortOrder=&quot;1&quot; \/&gt;\n    &lt;\/type&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<p>app\/code\/Webkul\/Hello\/extension_attributes.xml<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:Api\/etc\/extension_attributes.xsd&quot;&gt;\n    &lt;extension_attributes for=&quot;Magento\\Quote\\Api\\Data\\AddressInterface&quot;&gt;\n        &lt;attribute code=&quot;wkgstin&quot; type=&quot;string&quot; \/&gt;\n    &lt;\/extension_attributes&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<p>app\/code\/Webkul\/Hello\/Plugin\/Checkout\/Model\/ShippingInformationManagement.php<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Webkul\\Hello\\Plugin\\Checkout\\Model;\n\nuse Magento\\Quote\\Model\\QuoteRepository;\nuse \\Psr\\Log\\LoggerInterface;\n\nclass ShippingInformationManagement{\n    \n    protected $quoteRepository;\n    protected $logger;\n\n    public function __construct(QuoteRepository $quoteRepository,  LoggerInterface $logger) {\n        $this-&gt;quoteRepository = $quoteRepository;\n        $this-&gt;logger = $logger;\n    }\n\n    public function beforeSaveAddressInformation(\n        \\Magento\\Checkout\\Model\\ShippingInformationManagement $subject,\n        $cartId,\n        \\Magento\\Checkout\\Api\\Data\\ShippingInformationInterface $addressInformation\n    ) {\n        $shippingAddress = $addressInformation-&gt;getShippingAddress();\n        $extensionAttributes = $shippingAddress-&gt;getExtensionAttributes();\n\n        if ($extensionAttributes) {\n            if ($extensionAttributes-&gt;getWkgstin()) {\n                $gstin = $extensionAttributes-&gt;getWkgstin();\n                $shippingAddress-&gt;setWkgstin($gstin);\n            } else {\n                $shippingAddress-&gt;setWkgstin(&#039;&#039;);\n            }\n        }\n    }\n}<\/pre>\n\n\n\n<p>3) app\/code\/Webkul\/Hello\/Plugin\/Customer\/AddressEdit.php<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Webkul\\Hello\\Plugin\\Customer;\n\nuse Magento\\Framework\\View\\LayoutInterface;\nuse Webkul\\Hello\\Block\\Customer\\AddressEdit as CustomerAddress;\n\nclass AddressEdit\n{\n    \/**\n     * @var LayoutInterface\n     *\/\n    private $layout;\n\n    \/**\n     * Constructor Initialize\n     *\n     * @param LayoutInterface $layout\n     * @return void\n     *\/\n    public function __construct(\n        LayoutInterface $layout\n    ) {\n        $this-&gt;layout = $layout;\n    }\n\n    \/**\n     * Append gst field\n     *\n     * @param \\Magento\\Customer\\Block\\Address\\Edit $edit\n     * @param string $result\n     * @return mixed|string\n     *\/\n    public function afterGetNameBlockHtml(\n        \\Magento\\Customer\\Block\\Address\\Edit $edit,\n        $result\n    ) {\n        $customBlock =  $this-&gt;layout-&gt;createBlock(\n            CustomerAddress::class,\n            &#039;wkgst_address_edit_gstin&#039;\n        );\n        \n        return $result.$customBlock-&gt;toHtml();\n    }\n}<\/pre>\n\n\n\n<p>4) app\/code\/Webkul\/Hello\/Block\/Customer\/AddressEdit.php<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Webkul\\Hello\\Block\\Customer;\n\nuse Magento\\Framework\\View\\Element\\Template;\nuse Webkul\\Hello\\Block\\Customer\\Widget\\Gstin;\n\nclass AddressEdit extends Template\n{\n    \/**\n     * To html\n     *\n     * @return string\n     *\/\n    protected function _toHtml()\n    {\n        $gstinWidgetBlock = $this-&gt;getLayout()-&gt;createBlock(Gstin::class);\n        return $gstinWidgetBlock-&gt;toHtml();\n    }\n}<\/pre>\n\n\n\n<p>5) app\/code\/Webkul\/Hello\/Block\/Customer\/Widget\/Gstin.php<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Webkul\\Hello\\Block\\Customer\\Widget;\n\nuse Magento\\Customer\\Model\\AddressFactory;\nuse Magento\\Framework\\View\\Element\\Template;\nuse Magento\\Framework\\View\\Element\\Template\\Context;\n\nclass Gstin extends Template\n{\n    \/**\n     * @var AddressFactory\n     *\/\n    protected $_addressFactory;\n\n    \/**\n     * Constructor Initialize\n     *\n     * @param Context $context\n     * @param AddressFactory $addressFactory\n     * @param array $data\n     * @return void\n     *\/\n    public function __construct(\n        Context $context,\n        AddressFactory $addressFactory,\n        array $data = &#091;]\n    ) {\n        $this-&gt;_addressFactory = $addressFactory;\n        parent::__construct($context, $data);\n    }\n\n    \/**\n     * Set custom template\n     *\n     * @return void\n     *\/\n    public function _construct()\n    {\n        parent::_construct();\n\n        \/\/ default template location\n        $this-&gt;setTemplate(&#039;Webkul_Hello::widget\/gstno.phtml&#039;);\n    }\n\n    \/**\n     * Return gstin number from address\n     *\n     * @return string|null\n     *\/\n    public function getValue()\n    {\n        $addressId = $this-&gt;getRequest()-&gt;getParam(&#039;id&#039;);\n        if ($addressId) {\n            $addressCollection = $this-&gt;_addressFactory-&gt;create()-&gt;load($addressId);\n            $gstin = $addressCollection-&gt;getWkgstin();\n            if ($gstin) {\n                return $gstin;\n            }\n        }\n        return null;\n    }\n}<\/pre>\n\n\n\n<p>6) app\/code\/Webkul\/Hello\/view\/frontend\/templates\/widget\/gstno.phtml<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\/**\n * @var \\Webkul\\Module\\Block\\Customer\\Widget\\Gstin $block\n *\/\n?&gt;\n&lt;div class=\"field field-name-gstno\"&gt;\n    &lt;label class=\"label\" for=\"&lt;?= $block-&gt;escapeHtml('wkgstin') ?&gt;\"&gt;\n        &lt;span&gt;&lt;?= $block-&gt;escapeHtml(__('GST No.')) ?&gt;&lt;\/span&gt;\n    &lt;\/label&gt;\n    &lt;div class=\"control\"&gt;\n        &lt;input type=\"text\"\n            id=\"&lt;?= $block-&gt;escapeHtml('wkgstin') ?&gt;\"\n            name=\"&lt;?= $block-&gt;escapeHtml('wkgstin') ?&gt;\"\n            value=\"&lt;?= $block-&gt;escapeHtml($block-&gt;getValue()) ?&gt;\"\n            title=\"&lt;?= $block-&gt;escapeHtml(__('GST No')) ?&gt;\"\n            class=\"input-text\"\n        &gt;\n    &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\n\n\n<p>7) Execute following commands in magento root directory <br><br>php bin\/magento setup:upgrade <br>php bin\/magento setup:di:compile <br>php bin\/magento setup:static-content:deploy -f<\/p>\n\n\n\n<p>That is all for this blog, you may also check our <a href=\"https:\/\/store.webkul.com\/Magento-2.html\" target=\"_blank\" rel=\"noreferrer noopener\">best Magento 2 extensions<\/a> <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we need to get more information of the customer such as GST number, alternate mobile number etc. We can get the extra information of the customer. Here we will follow the webkul sample module Magento 2 hello world extension 2) Now we need to register a plugin for adding field in customer address form <a href=\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":440,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-364550","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create customer address field in Magento 2 - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create customer address field in Magento 2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Sometimes we need to get more information of the customer such as GST number, alternate mobile number etc. We can get the extra information of the customer. Here we will follow the webkul sample module Magento 2 hello world extension 2) Now we need to register a plugin for adding field in customer address form [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-17T11:27:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-13T13:30:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Amir Khan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Amir Khan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/\"},\"author\":{\"name\":\"Amir Khan\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f2493d3639b5e8c05ae4e9af5f71063a\"},\"headline\":\"How to create customer address field in Magento 2\",\"datePublished\":\"2023-01-17T11:27:51+00:00\",\"dateModified\":\"2023-12-13T13:30:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/\"},\"wordCount\":183,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/\",\"name\":\"How to create customer address field in Magento 2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2023-01-17T11:27:51+00:00\",\"dateModified\":\"2023-12-13T13:30:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create customer address field in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f2493d3639b5e8c05ae4e9af5f71063a\",\"name\":\"Amir Khan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/da678755fca2993231591a761683dc95fcf81f335982ea5c1b38e9ccc1c6bc0c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/da678755fca2993231591a761683dc95fcf81f335982ea5c1b38e9ccc1c6bc0c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Amir Khan\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/amir-khan754\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create customer address field in Magento 2 - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/","og_locale":"en_US","og_type":"article","og_title":"How to create customer address field in Magento 2 - Webkul Blog","og_description":"Sometimes we need to get more information of the customer such as GST number, alternate mobile number etc. We can get the extra information of the customer. Here we will follow the webkul sample module Magento 2 hello world extension 2) Now we need to register a plugin for adding field in customer address form [...]","og_url":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-01-17T11:27:51+00:00","article_modified_time":"2023-12-13T13:30:27+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Amir Khan","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Amir Khan","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/"},"author":{"name":"Amir Khan","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f2493d3639b5e8c05ae4e9af5f71063a"},"headline":"How to create customer address field in Magento 2","datePublished":"2023-01-17T11:27:51+00:00","dateModified":"2023-12-13T13:30:27+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/"},"wordCount":183,"commentCount":6,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/","url":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/","name":"How to create customer address field in Magento 2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2023-01-17T11:27:51+00:00","dateModified":"2023-12-13T13:30:27+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-create-customer-address-field-in-magento2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to create customer address field in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f2493d3639b5e8c05ae4e9af5f71063a","name":"Amir Khan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/da678755fca2993231591a761683dc95fcf81f335982ea5c1b38e9ccc1c6bc0c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/da678755fca2993231591a761683dc95fcf81f335982ea5c1b38e9ccc1c6bc0c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Amir Khan"},"url":"https:\/\/webkul.com\/blog\/author\/amir-khan754\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/364550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/440"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=364550"}],"version-history":[{"count":19,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/364550\/revisions"}],"predecessor-version":[{"id":414830,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/364550\/revisions\/414830"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=364550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=364550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=364550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}