WC_REST_Products_Controller::get_collection_params()
Add new options for 'orderby' to the collection params.
Метод класса: WC_REST_Products_Controller{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_REST_Products_Controller = new WC_REST_Products_Controller(); $WC_REST_Products_Controller->get_collection_params();
Код WC_REST_Products_Controller::get_collection_params() WC REST Products Controller::get collection params WC 9.2.3
public function get_collection_params() { $params = parent::get_collection_params(); $params['orderby']['enum'] = array_merge( $params['orderby']['enum'], array( 'price', 'popularity', 'rating' ) ); unset( $params['in_stock'] ); $params['stock_status'] = array( 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ), 'type' => 'string', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['search_sku'] = array( 'description' => __( 'Limit results to those with a SKU that partial matches a string.', 'woocommerce' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); return $params; }