Added enums to collection_params for stock_status.

This commit is contained in:
Peter Fabian 2018-09-10 12:36:18 +02:00
parent 0ddd8f4506
commit 1237e5ef7e
2 changed files with 2 additions and 0 deletions

View File

@ -893,6 +893,7 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V
$params['stock_status'] = array( $params['stock_status'] = array(
'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ), 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array_keys( wc_get_product_stock_status_options() ),
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );

View File

@ -1303,6 +1303,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller {
$params['stock_status'] = array( $params['stock_status'] = array(
'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ), 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array_keys( wc_get_product_stock_status_options() ),
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );