{"id":1807,"date":"2021-06-18T13:08:50","date_gmt":"2021-06-18T13:08:50","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/add-label-on-all-lines-in-street-address-in-magento-2-checkout-page\/"},"modified":"2025-07-16T17:40:38","modified_gmt":"2025-07-16T12:10:38","slug":"add-label-on-all-lines-in-street-address-in-magento-2-checkout-page","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/add-label-on-all-lines-in-street-address-in-magento-2-checkout-page\/","title":{"rendered":"How to Add Label on all Lines in Street Address in Magento 2 Checkout Page"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The modern business requirement can easily be fulfilled with the extensive functionality of customizable CMS and Magento 2 is the preferred one that is flexible to allow customization in the backend as well as frontend.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One such example is to&nbsp;<strong><em>add label on all lines in street address in Magento 2 checkout page<\/em><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The default\u00a0Magento 2\u00a0offers three textboxes under one label of a street address as shown below:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/06\/screencapture-meetanshi-in-kanchi-checkout-2021-05-24-17_59_23-577x1024.png\" alt=\"How to Add Label on all Lines in Street Address in Magento 2 Checkout Page\" class=\"wp-image-15123\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">However, the need may vary from business to business. A store owner may require to add the native words for address to enhance the customer\u2019s checkout experience.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What if you need to add a different label on each textbox to make it user-friendly? Or you may want to change the default label to more convenient ones for the targeted users, such as \u201cShipping Address 1\u201d or \u201cShipping Address 2\u201d for customers who utilize&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/configure-multiple-shipping-addresses-in-magento-2\/\">multiple shipping addresses<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the below code in such a scenario.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You may also need to&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/add-custom-field-in-checkout-page-below-payment-method-list-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">add a custom field in the checkout page below the payment method list in Magento 2<\/a>&nbsp;to make the seamless checkout process, and I\u2019ve posted the solution for the same.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Add Label on all Lines in Street Address in Magento 2 Checkout Page<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create&nbsp;<strong>di.xml<\/strong>&nbsp;file in&nbsp;<strong>app\/code\/Vendor\/Module\/etc\/frontend\/<\/strong>&nbsp;or Add the below code in your custom module\u2019s existing&nbsp;<strong>di.xml.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;type name=\"Magento\\Checkout\\Block\\Checkout\\LayoutProcessor\">\n    &lt;plugin name=\"rewrite-street-address\" type=\"Vendor\\ModuleName\\Plugin\\Checkout\\LayoutProcessorPlugin\"\n            sortOrder=\"10\"\/>\n&lt;\/type><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Add or create a&nbsp;<strong>LayoutProcessorPlugin.php<\/strong>&nbsp;file at&nbsp;<strong><strong>app\/code\/Vendor\/ModuleName\/Plugin\/Checkout\/<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\nnamespace Vendor\\ModuleName\\Plugin\\Checkout;\n\nclass LayoutProcessorPlugin\n{\n    public function afterProcess(\n        \\Magento\\Checkout\\Block\\Checkout\\LayoutProcessor $subject,\n        array $jsLayout\n    )\n    {\n        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']\n        ['shippingAddress']['children']['shipping-address-fieldset']['children']['street'] = [\n            'component' => 'Magento_Ui\/js\/form\/components\/group',\n            'label' => __('Address Label'), \/\/sreet address main label\n            'required' => false, \/\/ set false if removed sreet address label\n            'dataScope' => 'shippingAddress.street',\n            'provider' => 'checkoutProvider',\n            'sortOrder' => 0,\n            'type' => 'group',\n            'additionalClasses' => 'street',\n            'children' => [   \/\/ here add children as per your requirement\n                [\n                    'label' => __('Address Label 1'),\n                    'component' => 'Magento_Ui\/js\/form\/element\/abstract',\n                    'config' => [\n                        'customScope' => 'shippingAddress',\n                        'template' => 'ui\/form\/field',\n                        'elementTmpl' => 'ui\/form\/element\/input'\n                    ],\n                    'dataScope' => '0',\n                    'provider' => 'checkoutProvider',\n                    'validation' => ['required-entry' => true, \"min_text_len\u200c\u200bgth\" => 1, \"max_text_length\" => 255],\n                ],\n                [\n                    'label' => __('Address Label 2'),\n                    'component' => 'Magento_Ui\/js\/form\/element\/abstract',\n                    'config' => [\n                        'customScope' => 'shippingAddress',\n                        'template' => 'ui\/form\/field',\n                        'elementTmpl' => 'ui\/form\/element\/input'\n                    ],\n                    'dataScope' => '1',\n                    'provider' => 'checkoutProvider',\n                    'validation' => ['required-entry' => true, \"min_text_len\u200c\u200bgth\" => 1, \"max_text_length\" => 255],\n                ],\n                [\n                    'label' => __('Address Label 3'),\n                    'component' => 'Magento_Ui\/js\/form\/element\/abstract',\n                    'config' => [\n                        'customScope' => 'shippingAddress',\n                        'template' => 'ui\/form\/field',\n                        'elementTmpl' => 'ui\/form\/element\/input'\n                    ],\n                    'dataScope' => '2',\n                    'provider' => 'checkoutProvider',\n                    'validation' => ['required-entry' => true, \"min_text_len\u200c\u200bgth\" => 1, \"max_text_length\" => 255],\n                ],\n            ]\n        ];\n        return $jsLayout;\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once implemented, it displays the output as shown below:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/05\/screencapture-meetanshi-in-kanchi-checkout-2021-05-24-18_36_54-681x1024.png\" alt=\"How to Add Label on all Lines in Street Address in Magento 2 Checkout Page\" class=\"wp-image-15119\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do share the post with Magento Community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Also Read:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/meetanshi.com\/blog\/change-number-of-lines-in-street-address-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Change Number of Lines in Street Address in Magento 2<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The modern business requirement can easily be fulfilled with the extensive functionality of customizable CMS and Magento 2 is the preferred one that is flexible&#8230;<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1807","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1807"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1807\/revisions"}],"predecessor-version":[{"id":18047,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1807\/revisions\/18047"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}