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.