0
votes

It seems WooCommerce breaks Shipping/Billing Information prematurely (it's rather unprofessional looking). I'd like to know how to override it.

The way it posts:

First Name Last Name
Company
Street Address
City
State
Zip

It really should be (at least in the United States): First Name Last Name
Company
Street Address
City, State Zip

Any recommendations?

1

1 Answers

2
votes

Use the following function hooked in woocommerce_localisation_address_formats filter hook, to change the displayed formatted address for United States of America as desired:

add_filter( 'woocommerce_localisation_address_formats', 'change_usa_localisation_address_format', 20, 2 );
function change_usa_localisation_address_format( $address_formats ){
    $address_formats['US'] = "{name}\n{company}\n{address_1} {address_2}\n{city}, {state} {postcode}\n{country}";

    return $address_formats;
}

Code goes in functions.php file of your active child theme (or active theme). Tested and works.

If you like to don't display country, you will remove from the string at the end: \n{country}