How to customise the address format in WooCommerce

Each country has a different address format, for example, U.S. uses the abbreviated state name, while Australia usually shows the full state name.

These are not rules set in stone though and they can always be changed. How ? Via custom code of course!

Open your functions.php file in wp-content/themes/your-child-theme-name/ and add this code at the end of the file:

add_filter( 'woocommerce_localisation_address_formats', 'change_us_address_format' );
function change_us_address_format( $formats ) {
$formats['US'] = "{name}\n{company}\n{address_1}\n{address_2}\n{city}, {state} {postcode}\n{country}";
return $formats;
view raw functions.php hosted with ❤ by GitHub

This code changes the address format for the United States, using the full state name instead of the state code so that an address like:

Nicola Mustone
937 South Green St.
Fresno, CA 93722

will become:

Nicola Mustone
937 South Green St.
Fresno, California 93722

Address format options

In the code, you can see some placeholders like {name}  or {state}, but there are many of these that you can use in your custom format.

Here is a complete list:

  • {first_name}
  • {last_name}
  • {name}
  • {company}
  • {address_1}
  • {address_2}
  • {city}
  • {state}
  • {postcode}
  • {country}
  • {first_name_upper}
  • {last_name_upper}
  • {name_upper}
  • {company_upper}
  • {address_1_upper}
  • {address_2_upper}
  • {city_upper}
  • {state_upper}
  • {state_code}
  • {postcode_upper}
  • {country_upper}

More Posts That You Might Like…

2 responses to “How to customise the address format in WooCommerce”

  1. working good i need to check how to setup that in woocommerce so i can finish it

  2. Thanks for your useful post. Do you have any plugin recommendations? I just want to customize the address format with some simple clicks, instead of entering this code. 🙂

Leave a Reply



Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Blog at

%d bloggers like this: