Also fetch in_stock when stock_status requested in V2.
When called from V3, controller calls V2s get_product_data method, where stock_status was did not existed and was renamed. In V3 controller, we compute it based on V2 in_stock field.
This commit is contained in:
parent
c6f6d04c2e
commit
0d43aecebd
|
@ -293,6 +293,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller {
|
|||
$data['coupon_lines'] = $order->get_items( 'coupon' );
|
||||
break;
|
||||
case 'refunds':
|
||||
$data['refunds'] = array();
|
||||
foreach ( $order->get_refunds() as $refund ) {
|
||||
$data['refunds'][] = array(
|
||||
'id' => $refund->get_id(),
|
||||
|
|
|
@ -753,6 +753,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller {
|
|||
case 'stock_quantity':
|
||||
$base_data['stock_quantity'] = $product->get_stock_quantity( $context );
|
||||
break;
|
||||
case 'stock_status': // For API V3, this field is computed using `in_stock`.
|
||||
case 'in_stock':
|
||||
$base_data['in_stock'] = $product->is_in_stock();
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue