If you are just starting out, you may not have a very wide reach, you may not have any international orders, and you might not even have orders from outside your state or province. If that's the case, why make people type it in? With a touch of code, we can set some defaults that will help people get through the checkout process.
This code can either go in your theme's functions.php
file or in a custom WooCommerce plugin. Let's take a look at the following steps:
Open either your theme's functions.php file or a custom plugin file.
We'll start by setting just the default country. At the bottom of the file, add the following code:
add_filter( 'default_checkout_country', 'woocommerce_cookbook_default_checkout_country' ); // change the default country to USA function woocommerce_cookbook_default_checkout_country() { return 'US'; }
If you also want to set a default state, you'll have to add a bit more code. In the following...