Search Documentation

WP Travel User Documentation

  1. Home
  2. Docs
  3. WP Travel User Documentation
  4. Support Queries
  5. How to change default country in form field?

How to change default country in form field?

If you would like to change the default country in the final booking form field you can add below given code in your child theme functions.php file. To know how to create the child theme please refer to below given link: Child Theme  After creating the child theme in your child theme functions.php file add below given code.

function wp_travel_customize_default_country_setting(){
?>
  <script type="text/javascript">
  jQuery(document).ready(function(){
    jQuery('#wp-travel-country > option[value="CH"]').attr("selected",true);
  });
  </script>
<?php
}
add_action( 'wp_footer', 'wp_travel_customize_default_country_setting', 20 );

You need to change the value (data code) according to your countries default data code in above given code.

Line where you need to change the value:

jQuery('#wp-travel-country > option[value="AU"]').attr("selected",true);
Was this article helpful to you? Yes No

How can we help?