WC_Shipping_Zone_Data_Store::get_zone_locations_for_ids
Retrieve the zone location data for the given zone_ids.
Метод класса: WC_Shipping_Zone_Data_Store{}
Хуков нет.
Возвращает
stdClass[]. An array of objects containing the zone_id, location_code, and location_type for each zone location.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_zone_locations_for_ids( $ids );
- $ids(массив) (обязательный)
- The zone_ids to retrieve.
Код WC_Shipping_Zone_Data_Store::get_zone_locations_for_ids() WC Shipping Zone Data Store::get zone locations for ids WC 10.8.1
private function get_zone_locations_for_ids( array $ids ) {
global $wpdb;
if ( empty( $ids ) || array( '0' ) === $ids || array( 0 ) === $ids ) {
return array();
}
$zone_ids = array_map( 'absint', $ids );
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- $zone_ids already run through absint.
return $wpdb->get_results(
"SELECT zone_id, location_code, location_type FROM {$wpdb->prefix}woocommerce_shipping_zone_locations " .
'WHERE zone_id IN ( ' . implode( ',', $zone_ids ) . ' ) '
);
// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
}