Booking Form Default Country

Homepage Forums WP Travel Booking Form Default Country

This topic contains 6 replies, has 4 voices, and was last updated by  wensolutions 4 weeks, 1 day ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #16305

    Hi,
    On the booking form my default country is Afghanistan, how do I change this?

    #16308

    wensolutions
    Keymaster

    Hello,

    To change the default country in the booking field, please follow below given link:

    https://wptravel.io/change-default-country-in-the-booking-form/

    Hope this helps.

    If you have any query/confusion further then please let us know.

    Thank you.

    #16924

    paulo232
    Participant

    Have tried the above code, still stuck on Afghanistan?

    #16943

    Support Team
    Keymaster

    Hello @paulo232,

    When we tested the code, we found that the code is working absolutely fine as you can see in the screenrecord below:

    https://www.loom.com/share/f134b2a719c348639169abb3eed18a2a

    So make sure you have added the correct code.

    Hope this helps.

    Thank you.

    #17025

    paulo232
    Participant

    This is the code we have added from the article we read, we just changed to UK so it defaults to United Kingdom but when we use site its still stuck on Afghanistan?

    function wp_travel_customize_booking_form($fields) {

    $fields[‘traveller_fields’][‘country’][‘default’] = ‘UK’;
    $fields[‘billing_fields’][‘country’][‘default’] = ‘UK’;

    return $fields;
    }

    add_filter( ‘wp_travel_checkout_fields’, ‘wp_travel_customize_booking_form’, 99 );

    #17028

    Hi,
    I used the SNIPPETS PLUGIN and added the second block in the link mentioned by WEN Sulutions https://wptravel.io/change-default-country-in-the-booking-form/

    function wp_travel_customize_booking_form($fields) {
    
       $fields['traveller_fields']['country']['default'] = 'NL';
       $fields['billing_fields']['country']['default'] = 'NL';
    
       return $fields;
    }
    
    add_filter( 'wp_travel_checkout_fields', 'wp_travel_customize_booking_form', 99 );

    **Make sure you use the correct country code 🙂 ** I think country code for United Kingdom is GB

    #17043

    wensolutions
    Keymaster

    Hello @lorrainecreativeimagineering-cp-za,

    Thank you very much for your help 🙂 .

    Hello @paulo232,

    Since there are two blocks of code, the lower one work in the latest version of the theme. So please verify properly. If the problem still persists kindly let us know.

    Thank you.

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

You must be logged in to reply to this topic.