default country on the checkout page

How to change default country on the checkout page in WooCommerce

If most of Your customers are from one particular country it makes sense to change default Country on the Checkout page. You can also preset to one particular State.

In order to change default country, All you have to do is add below code in your theme‘s functions.php file or use code snippets plugin

// Change the default state and country on the checkout page

add_filter( 'default_checkout_billing_country', 'change_default_checkout_country' );
add_filter( 'default_checkout_billing_state', 'change_default_checkout_state' );

function change_default_checkout_country() {
  return 'US'; // country code for United States

function change_default_checkout_state() {
  return 'NY'; // state code for New York

In above code snippet, we use United State Country code (US) in line 7 and New York(NY) State code in line 11. You can change the country and State code to whatever you need to…

You can find any country code on

Keep in mind above code snippet affects both current and non-existing users.

If you want to only change the default Country for new users, then you can use this code snippet instead:

// Change the default country on the checkout for non-existing users only

add_filter( 'default_checkout_billing_country', 'change_default_checkout_country', 10, 1 );

function change_default_checkout_country( $country ) {
    // If the user already exists, don't override country
    if ( WC()->customer->get_is_paying_customer() ) {
        return $country;

    return 'DE'; // Override default to Germany (an example)

I hope this article helped you set any Country as default on the Checkout page in WooCommerce.

Have any question? Don’t forget to leave a comment below…

Leave a Reply

Your email address will not be published. Required fields are marked *