Developers may at times need to directly interact with this plugin to achieve their goals. Here are some useful functions that can help. Note that all functions are namespaced, so you will need to import them at the start of your PHP file, like this:
use webaware\gf_address_enhanced\get_country_name;
get_
country_ name - string $country_code
- return string
Attempt to convert a country code to a country name.
get_
state_ code_ as_ iso_ 3166_ 2 - string $state_code
- string $country_code
- return string
- throws CountryException
Convert a short state code for a country into a full ISO-3166-2 state code.
get_
state_ code_ as_ name - string $state_code
- string $country_code
- return string
- throws CountryException
Convert a short state code for a country into its name.
get_
state_ code_ as_ woocommerce - string $state_code
- string $country_code
- return string
- throws CountryException
Convert a short state code for a country into a WooCommerce-compatible state code.
get_
state_ code_ by_ name - string $state_name
- string $country_name
- string $type
- return string
- throws CountryException
Convert a state name for a country into its short state code. $country_name can be a country name or an ISO code.