Skip to content
Advertisement

How to get the complete state name from a WooCommerce order?

I’m new to WordPress and WooCommerce plugins and such. I’m writing a plugin and I need to send some data to a SOAP API, the case is that the API only accepts the state full name but I’m only getting the abbreviated form from WooCommerce.

JavaScript

The important bit is:

JavaScript

How can I get the full state name here instead of the abbreviation?

Advertisement

Answer

You can use the following to display the state name from country and state codes:

JavaScript

Tested and works.

You can also use billing country and state with:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement