Conditionally allow stock_quantity to be non-integer in REST API product schema (#48541)
This commit is contained in:
parent
da329a1620
commit
fb25aa86a4
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Allow products with non-integer stock to be created via REST API.
|
|
@ -1951,7 +1951,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller {
|
|||
),
|
||||
'stock_quantity' => array(
|
||||
'description' => __( 'Stock quantity.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'type' => has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'integer' : 'number',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
),
|
||||
'in_stock' => array(
|
||||
|
|
|
@ -1908,7 +1908,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller {
|
|||
),
|
||||
'stock_quantity' => array(
|
||||
'description' => __( 'Stock quantity.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'type' => has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'integer' : 'number',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
),
|
||||
'in_stock' => array(
|
||||
|
|
|
@ -1131,7 +1131,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller {
|
|||
),
|
||||
'stock_quantity' => array(
|
||||
'description' => __( 'Stock quantity.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'type' => has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'integer' : 'number',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
),
|
||||
'stock_status' => array(
|
||||
|
|
Loading…
Reference in New Issue