I want to add city drop down in checkout page instead of text field. Searching online couldn't get any solution. Also use this extension https://github.com/EaDesgin/Magento2-City-Dropdown ,but this module is not working properly. SO any other solution??

1 Answer 1


For Frontend:

In layout file checkout_index_index call the template file which has your dropdown html code.it will be displayed on you checkout page.

Code: file name has checkout_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="content">
             <block class="Test\CommunityCommerce\Block\Checkoutmod\Checkoutmod" name="Checkoutmod_Checkoutmod" after="checkout.cart.coupon" template="Sundial_CommunityCommerce::checkout/cart/Checkoutmod.phtml">

In Template file consists :

file name has Checkoutmod.phtml

<div class="content" data-role="content" aria-labelledby="block-Checkoutmod-heading">
        <form id="Checkoutmod-form"
              value="0" />
            <?php //echo $block->getBlockHtml('formkey') ?>
                <div class="field">
                    <div class="control">
                         <select id="Checkoutmod_id" name="Checkoutmod_id">                     
                                <option value="test1">test1</option>
                                <option value="test2">test2</option>


Create column in quote table and sales table using setup scripts using "InstallSchema" it will create column into table.

After that using sales_convert_quote and fieldset.xml it will move to quote value to sales table.

  • Thanks @Hamendra Sunthwal. But will drop down created for city in address from in checkout page by this code? or it will reate just an extra filed in checkout form? Commented Aug 7, 2020 at 6:46
  • This example shows how select field can be created, you can use the method & implement in existing field. Commented Aug 7, 2020 at 7:34

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.