I want to custom field "City" to dropdown list in checkout page (magento 2.1.5).

Is it possible? How can do that?

enter image description here

New update:

enter image description here

Thank you!

  • Are you able to figure it out?
    – MagePsycho
    Commented Nov 2, 2017 at 7:04
  • you are checking on checkout page. But you written code for cart page. So check your cart page. You can see dropdown there Commented Sep 15, 2021 at 7:27

1 Answer 1


By default there is no option in magento2 for making the city field as dropdown like state and country in the checkout page.

An approach would be to add relations to the directory_country and/or directory_country_region tables to only show cities which belong to the specific country or region selected in the checkout.

you will need to overwrite of the class \Magento\Checkout\Block\Checkout\LayoutProcessor by using 'options' value provided by the third party api for city(or use a custom array):-

 $elements = [
        'city' => [
            'visible' => true,
            'formElement' => 'select',
            'label' => __('City'),
            'value' =>  '',
            'options' => array_option(),

Hope this helps

  • Thank you. I have tried your way, but seem to not work. Does I need to changes anything else? I have changed in: vendor\Magento\Checkout\Block\Cart\LayoutProcessor. Please review my new attach image above. Thanks! Commented Sep 28, 2017 at 1:57
  • 1
    @TriAnhHuynh If you have fixed this please share you code Commented Nov 20, 2019 at 11:57
  • 1
    please share your code i also have the same requirement Commented Sep 15, 2020 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.