Having the state as a full name
-
I am working on a custom template and I would like to have the state name to be shown as a full name. I saw this post https://www.ads-software.com/support/topic/how-to-split-billing-address-name/ and checked the documentation but nothing worked
I did the below but still, nothing is showing except one code just showed me the state code not the full name. BTW, the country is Saudi Arabia.
in child theme function
…………………………………
add_filter( ‘woocommerce_localisation_address_formats’, ‘change_localisation_usa_state_format’, 20, 2 );
function change_localisation_usa_state_format( $address_formats ){
$address_formats[‘SA’] = “{name}\n{company}\n{address_1}\n{address_2}\n{city}, {state} {postcode}\n{country}”;return $address_formats;
}
…………………………………in the custom template, I tried all the below
…………………………………
a. <td><?php $this->get_shipping_state(); ?></td> // shows nothing
b. <td><?php $this->order->get_shipping_state(); ?></td> // shows nothing
c. <td><?php $order->get_shipping_state(); ?></td> // shows nothing
d. <td><?php echo $order->get_meta(‘_shipping_state’); ?></td> // shows nothing
e. <td><?php echo $order->get_meta(‘shipping_state’); ?></td> // shows nothing
f. <td><?php $this->custom_field(‘_shipping_state’); ?></td> // shows Code only
………………………………….and the order meta field is showing the correct label (IMG attached) https://ibb.co/3y8y5Nq
I don’t know what I am doing wrong. Please advice.
- The topic ‘Having the state as a full name’ is closed to new replies.