Hi there,
This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.
I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.
You can also visit the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.
Cheers.
Hey @yurbshop21,
It sounds like $address['state'] only stores the state’s abbreviation. You would need to use a function or a set of conditional statements that takes the abbreviation and converts it into the state name.
<?php
if ( $address['state'] == 'LA' ) {
echo 'Lagos';
} elseif ( $address['state'] == 'NA' ) {
echo 'Nasarawa';
} else {
echo $address['state'];
}
?>
Thread Starter
Olufemi
(@yurbshop21)
Thanks @3sonsdevelopment doesn’t work for me
Thread Starter
Olufemi
(@yurbshop21)
Thanks @paulostp , I copied this to override state display format across my page. I used NG in place of US, then it rolled back
sk_use_full_us_state_names
add_filter( 'woocommerce_localisation_address_formats', 'sk_use_full_us_state_names', 20, 2 );
function sk_use_full_us_state_names( $address_formats ){
$address_formats['US'] = "{name}\n{company}\n{address_1}\n{address_2}\n{city}, {state} {postcode}\n{country}";
return $address_formats;
}
Thread Starter
Olufemi
(@yurbshop21)
I need the full state display in single product page
Hi @yurbshop21
I am sure it’s already on your radar, but the function above will just change the order that which the items are displayed, it’s still using the state which is still storing only the abbreviation of each state.
If you’re comfortable with coding, I’d give the suggestion made by @3sonsdevelopment a try, maybe wrapping up into a function is a good alternative.
Also, since this kind of customization is a bit out of scope for us, if everything fails, I’d embrace @rainfallnixfig suggestion! Asking on the Facebook Group or the Slack channel sounds like a great plan.
Let us know if you have other questions!
My very best!