Home › Forums › WoodMart support forum › checkout city dropdown
checkout city dropdown
- This topic has 5 replies, 2 voices, and was last updated 8 months, 3 weeks ago by Luke Nielsen.
-
AuthorPosts
-
March 21, 2024 at 3:42 am #550909
toushibcParticipantHi I got the below code from support forum and it’s perfectly works for me
I need this dropdown for one specific country only and for other country some other cityCan i have the modified code please
// Change “city” checkout billing and shipping fields to a dropdown
add_filter( ‘woocommerce_checkout_fields’ , ‘override_checkout_city_fields’ );function override_checkout_city_fields( $fields ) {
// Define here in the array your desired cities (Here an example of cities)
$option_cities = array(
” => __( ‘Select your city’ ),
‘Doha’ => ‘Doha’,
‘Al Rayyan’ => ‘Al Rayyan’,
‘Faisalabad’ => ‘Faisalabad’,
‘Rawalpindi’ => ‘Rawalpindi’,
‘Gujranwala’ => ‘Gujranwala’,
‘Peshawar’ => ‘Peshawar’,
‘Multan’ => ‘Multan’,
‘Hyderabad’ => ‘Hyderabad’,
‘Islamabad’ => ‘Islamabad’
);$fields[‘billing’][‘billing_city’][‘type’] = ‘select’;
$fields[‘billing’][‘billing_city’][‘options’] = $option_cities;
$fields[‘shipping’][‘shipping_city’][‘type’] = ‘select’;
$fields[‘shipping’][‘shipping_city’][‘options’] = $option_cities;
return $fields;
}March 21, 2024 at 12:39 pm #551040
Luke NielsenKeymasterHello,
Sorry, but fixing the third-party code or making Customization is not included in our support, it is beyond our limitations and support policy scope. Hope you can understand our limitations.
Don’t hesitate to let me know if you need any further help or any other info
Kind Regards
March 21, 2024 at 12:55 pm #551049
toushibcParticipantYes I understand dear
I got this code also from your support forum
I was amazed actually by seeing the support forum before buy the themeI hope you will not disappoint me
It’s just a piece of code you if you can combine and provide can solve this
add_filter( ‘wc_city_select_cities’, ‘my_cities’ );
/**
* Replace XX with the country code. Instead of YYY, ZZZ use actual state codes.
*/
function my_cities( $cities ) {
$cities[‘XX’] = array(
‘YYY’ => array(
‘City ‘,
‘Another City’
),
‘ZZZ’ => array(
‘City 3’,
‘City 4’
)
);
return $cities;
}this code and before code combine can work
all code got from your support forum
It will be highly appreciated if you can help me on this please
March 22, 2024 at 1:11 pm #551415
Luke NielsenKeymasterHello,
Could you please send the URL link to the thread where you found this part of the code? So it will help me to understand it a dig deeper.
Thank you in advance.
Kind Regards
March 22, 2024 at 9:47 pm #551563
toushibcParticipantplease find the links
It will be highly appreciated if providing the combined code please
March 26, 2024 at 10:47 am #552240
Luke NielsenKeymasterHello,
Thank you for reaching out with your request for customization. I understand that you’re looking for a solution tailored to your specific needs.
I want to be transparent with you about the limitations I’m facing. While I strive to provide personalized solutions for each of my clients, in this particular case, I’ve encountered a challenge. That code from that mentioned topic was found on the Internet but for your situation, I cannot find anything, unfortunately.
Despite my best efforts to adapt or find similar solutions, I regret to inform you that I haven’t been successful in locating a suitable match for your requirements.
Thank you for your understanding and patience. If you have any further questions or concerns, please don’t hesitate to let me know.
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register