Want to know what WordPress Theme a site is using? Check Out Now!

How to Change the Default State & Country on WooCommerce Checkout?

Do you want to change the default state and country on the WooCommerce checkout of your WordPress website?

By default, WooCommerce has “California” as the default state and the “United States (US)” as the default country.

So even if you are selling products in Germany and your customers are local customers, it will still show California and the United States as the default states and countries.

If you want to change it, you can use the below code snippet.

/**
 * Change the default state on the WooCommerce checkout page
 */
function maverick_change_default_checkout_country() {
    return 'XX'; // country code
}

add_filter( 'default_checkout_billing_country', 'maverick_change_default_checkout_country' );

/**
 * Change the default state on the WooCommerce checkout page
 */
function maverick_change_default_checkout_state() {
    return 'XX'; // state code
}

add_filter( 'default_checkout_billing_state', 'maverick_change_default_checkout_state' );

Leave a Reply

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