get_results( $wpdb->prepare( " SELECT location_code, location_type FROM {$wpdb->prefix}woocommerce_tax_rate_locations WHERE tax_rate_id = %d ", $tax->tax_rate_id ) ); if ( ! is_wp_error( $tax ) && ! is_null( $tax ) ) { foreach ( $locales as $locale ) { if ( 'postcode' === $locale->location_type ) { $data['postcodes'][] = $locale->location_code; } elseif ( 'city' === $locale->location_type ) { $data['cities'][] = $locale->location_code; } } } return $data; } /** * Get the taxes schema, conforming to JSON Schema. * * @return array */ public function get_item_schema() { $schema = parent::get_item_schema(); $schema['properties']['postcodes'] = array( 'description' => __( 'List of postcodes / ZIPs.', 'woocommerce' ), 'type' => 'array', 'items' => array( 'type' => 'string', ), 'context' => array( 'view', 'edit' ), ); $schema['properties']['cities'] = array( 'description' => __( 'List of city names.', 'woocommerce' ), 'type' => 'array', 'items' => array( 'type' => 'string', ), 'context' => array( 'view', 'edit' ), ); return $schema; } }