Booking Form Default Country

Homepage Forums WP Travel Booking Form Default Country

This topic contains 16 replies, has 6 voices, and was last updated by  Support Team 3 months, 2 weeks ago.

Viewing 15 posts - 1 through 15 (of 17 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.

    #18427

    mashaku
    Participant

    Hello, I also have a problem with default country
    In my site there is a previous booking form without cart process.
    I tried to add both code provide above, but it does not works
    Now the code is
    /*Change default country in the Booking form*/
    function wp_travel_customize_booking_form($fields) {

    $fields[‘country’][‘default’] = ‘ES’;

    return $fields;

    }

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

    #18431

    Support Team
    Keymaster

    Hello @mashakhu,

    Can you please mention the WP Travel version that you are currently using so that we can help you further?

    Thank you.

    #18432

    mashaku
    Participant

    Just upgrade up to 2.0.9

    #18447

    Support Team
    Keymaster

    Hello @mashakhu,

    Please refer to below-given link to change the default country in the form.

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

    Hope this helps.

    Thank you.

    #18452

    mashaku
    Participant

    You send me the link to this topic. As I’ve told you I already tried both code, but nothing change
    Now I add the second one
    /*Change default country in the Booking form*/
    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 );
    Still doesn’t work 🙁
    Screen below
    http://prntscr.com/omumd3

    #18454

    Support Team
    Keymaster

    Hello @mashakhu,

    While we have tested the given snippet of code with default themes like TwentyNinteen and compatible themes with WP Travel plugin which seems to work perfectly fine.

    Compatible themes link:
    https://wptravel.io/wordpress-travel-themes/

    So we are not sure what’s causing the conflict with the provided code-tweak.

    Unfortunately, there’s a difference between the support we can offer and the level of programming needed to change (core) features of our plugin. Since we don’t want to take the risk that we break your website by suggesting incorrect or incomplete code, we cannot advise you on how to make further changes. And even though we cannot be of any assistance, you’re completely free to change anything in the plugin to better suit your needs.

    We highly recommend checking out available freelance WordPress developers or hire our customizers to look into the issue specific to your setup.

    To hire a customizer refer to below-given link:
    https://wptravel.io/hire-our-customizer/

    We hope that you understand this concern.

    Thank you.

    #18455

    mashaku
    Participant

    It´s very pity to hear it.
    Because I only use our theme and your plugin. And nobody knows it´s better then the developers.
    All the customization being done in the web site was made by yours programmer
    If you can´t advise me how can I change the default company, can you tell me how can I disable this field
    Regards

    #18460

    Support Team
    Keymaster

    Hello @mashaku,

    Thank you, your concerns are valid.

    There might be several other reasons why given snippet might not work:

    1. Due to conflict with other 3rd-party plugins that exist in your setup. You should check this by disabling all other plugins.

    2. Snippet generally to be paste in functions.php of your theme file so make sure you have properly added the provide code in your child theme’s fucntions.php file.

    3. Check the error log for any error thrown.

    Let us know if the above mention steps work or not?

    Thank you.

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.