WC_Shipping_Zones::get_country_code_from_state_code
Get the country code from a state location code.
Method of the class: WC_Shipping_Zones{}
No Hooks.
Returns
string. Country code.
Usage
$result = WC_Shipping_Zones::get_country_code_from_state_code( $state_code );
- $state_code(string) (required)
- State location code.
Changelog
| Since 11.1.0 | Introduced. |
WC_Shipping_Zones::get_country_code_from_state_code() WC Shipping Zones::get country code from state code code WC 11.1.2
private static function get_country_code_from_state_code( $state_code ) {
$state_code_parts = explode( ':', $state_code );
return $state_code_parts[0] ?? '';
}