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
Before implementing any code changes, always ensure your site is backed up. This will help you restore things in case of unforeseen errors. I recommend using Jetpack Backup for real-time backups and one-click restores.
Open your functions.php file in wp-content/themes/your-child-theme-name/ and add this code at the end of the file:
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
{name}
{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}
Leave a Reply