WC_Shipping_Zones::zone_has_unsupported_non_postcode_locations
Check whether a zone has non-postcode locations not understood by this warning helper.
Method of the class: WC_Shipping_Zones{}
No Hooks.
Returns
bool. Whether the zone has unsupported non-postcode locations.
Usage
$result = WC_Shipping_Zones::zone_has_unsupported_non_postcode_locations( $zone );
- $zone(array) (required)
- Shipping zone.
Changelog
| Since 11.1.0 | Introduced. |
WC_Shipping_Zones::zone_has_unsupported_non_postcode_locations() WC Shipping Zones::zone has unsupported non postcode locations code WC 11.1.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;
}