Magento 2 : How to modify city field html for shipping address on checkout page

I need to edit the city field HTML of New shipping address form on checkout in Magento 2.

I am not getting the file from where we can change this or add some classes in these fields. Please share some idea to achieve this.

Magento Asked by Ashish Jagnani on February 18, 2021

2 Answers

2 Answers


<type name="MagentoCheckoutBlockCheckoutAttributeMerger">
    <plugin name="customAttributeMerger" type="VendorNameSpaceModulePluginAttributeMergerPlugin"/>

AttributeMergerPlugin.php VendorNameSpaceModulePlugin

namespace VendorNameSpaceModulePlugin;

class AttributeMergerPlugin
    public function afterMerge(MagentoCheckoutBlockCheckoutAttributeMerger $subject, $result)

        if (array_key_exists('city', $result)) {
            $result['city']['additionalClasses'] = 'cusotom_city';

        return $result;

Hope this will help you. thanks

Answered by Ranjeet Kumar on February 18, 2021

Here is the path where you can edit city text field for New Shipping Address Form which was rendered form XML file:


Answered by Varma on February 18, 2021

Add your own answers!

Related Questions

Magento 2 : print_r or var_dump is not working

4  Asked on July 30, 2020 by zed-blackbeard


Create quick order form at product page

0  Asked on July 29, 2020 by faraz-bashir


How to Special price based on attribute?

2  Asked on July 26, 2020 by user90560


is creating block within template in magento 2 good practice

0  Asked on July 24, 2020 by herve-tribouilloy


Ask a Question

Get help from others!

© 2021 All rights reserved.