WC_Shipping_Zones::zone_has_unsupported_non_postcode_locations │ private static │ WC 11.1.0

Check whether a zone has non-postcode locations not understood by this warning helper.

Метод класса: WC_Shipping_Zones{}

Хуков нет.

Возвращает

bool. Whether the zone has unsupported non-postcode locations.

Использование

$result = WC_Shipping_Zones::zone_has_unsupported_non_postcode_locations( $zone );
$zone(массив) (обязательный)
Shipping zone.

Список изменений

С версии 11.1.0 Введена.

Код WC_Shipping_Zones::zone_has_unsupported_non_postcode_locations() WC 11.2.2

private static function zone_has_unsupported_non_postcode_locations( $zone ) {
	$locations                = $zone['zone_locations'] ?? array();
	$supported_location_types = array( 'continent', 'country', 'state', 'postcode' );

	foreach ( $locations as $location ) {
		if ( isset( $location->type ) && ! in_array( $location->type, $supported_location_types, true ) ) {
			return true;
		}
	}

	return false;
}