I want to custom field "City" to dropdown list in checkout page (magento 2.1.5).
Is it possible? How can do that?
New update:
Thank you!
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI want to custom field "City" to dropdown list in checkout page (magento 2.1.5).
Is it possible? How can do that?
New update:
Thank you!
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