WC_Shipping_Zones::get_continent_code_for_location
Get the continent code for a country or state location.
Метод класса: WC_Shipping_Zones{}
Хуков нет.
Возвращает
string. Continent code, or an empty string.
Использование
$result = WC_Shipping_Zones::get_continent_code_for_location( $location );
- $location(объект) (обязательный)
- Location.
Список изменений
| С версии 11.1.0 | Введена. |
Код WC_Shipping_Zones::get_continent_code_for_location() WC Shipping Zones::get continent code for location WC 11.2.2
private static function get_continent_code_for_location( $location ) {
$type = $location->type ?? '';
$code = $location->code ?? '';
if ( 'continent' === $type ) {
return $code;
}
$country_code = 'state' === $type ? self::get_country_code_from_state_code( $code ) : $code;
return WC()->countries->get_continent_code_for_country( $country_code );
}