Home Forums WoodMart support forum checkout city dropdown

checkout city dropdown

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #550909

    toushibc
    Participant

    Hi 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 city

    Can 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;
    }

    #551040

    Luke Nielsen
    Keymaster

    Hello,

    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

    #551049

    toushibc
    Participant

    Yes I understand dear
    I got this code also from your support forum
    I was amazed actually by seeing the support forum before buy the theme

    I 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

    #551415

    Luke Nielsen
    Keymaster

    Hello,

    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

    #551563

    toushibc
    Participant

    please find the links

    It will be highly appreciated if providing the combined code please

    #552240

    Luke Nielsen
    Keymaster

    Hello,

    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

Viewing 6 posts - 1 through 6 (of 6 total)