Instead of 2 letter state abbreviation, I would like to show the full state name.
On this page /plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php
<div class="order_data_column">
<h3>
<?php esc_html_e( 'Billing', 'woocommerce' ); ?>
<a href="#" class="edit_address"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a>
<span>
<a href="#" class="load_customer_billing" style="display:none;"><?php esc_html_e( 'Load billing address', 'woocommerce' ); ?></a>
</span>
</h3>
<div class="address">
<?php
// Display values.
if ( $order->get_formatted_billing_address() ) {
echo '<p>' . wp_kses( $order->get_formatted_billing_address(), array( 'br' => array() ) ) . '</p>';
} else {
echo '<p class="none_set"><strong>' . __( 'Address:', 'woocommerce' ) . '</strong> ' . __( 'No billing address set.', 'woocommerce' ) . '</p>';
}
foreach ( self::$billing_fields as $key => $field ) {
if ( isset( $field['show'] ) && false === $field['show'] ) {
continue;
}
$field_name = 'billing_' . $key;
if ( isset( $field['value'] ) ) {
$field_value = $field['value'];
} elseif ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
$field_value = $order->{"get_$field_name"}( 'edit' );
} else {
$field_value = $order->get_meta( '_' . $field_name );
}
if ( 'billing_phone' === $field_name ) {
$field_value = wc_make_phone_clickable( $field_value );
} else {
$field_value = make_clickable( esc_html( $field_value ) );
}
if ( $field_value ) {
echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . wp_kses_post( $field_value ) . '</p>';
}
}
?>
</div>
Thank you so much in advance.
The only country in Woocommerce, that display the state as a code in the formatted address is USA.
To display the state name for USA in the formatted billing or shipping addresses, use the following code:
add_filter( 'woocommerce_localisation_address_formats', 'change_localisation_usa_state_format', 20, 2 );
function change_localisation_usa_state_format( $address_formats ){
$address_formats['US'] = "{name}\n{company}\n{address_1}\n{address_2}\n{city}, {state} {postcode}\n{country}";
return $address_formats;
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.