Bug fixes for the new low in stock endpoint (https://github.com/woocommerce/woocommerce-admin/pull/7389)
* Bug fixes for the low in stock endpoint * post_parent type should be int * type should be either simple or variation * Remove cache-control
This commit is contained in:
parent
199b042e77
commit
8ce0808578
|
@ -77,7 +77,6 @@ final class ProductsLowInStock extends \WC_REST_Products_Controller {
|
|||
$response = rest_ensure_response( array_values( $query_results['results'] ) );
|
||||
$response->header( 'X-WP-Total', $query_results['total'] );
|
||||
$response->header( 'X-WP-TotalPages', $query_results['pages'] );
|
||||
$response->header( 'Cache-Control', 'max-age=300' );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@ -205,9 +204,9 @@ final class ProductsLowInStock extends \WC_REST_Products_Controller {
|
|||
'low_stock_amount' => $query_result->low_stock_amount,
|
||||
'last_order_date' => wc_rest_prepare_date_response( $query_result->last_order_date ),
|
||||
'name' => $query_result->post_title,
|
||||
'parent_id' => $query_result->post_parent,
|
||||
'parent_id' => (int) $query_result->post_parent,
|
||||
'stock_quantity' => (int) $query_result->stock_quantity,
|
||||
'type' => 'product_variation' === $query_result->post_type ? 'variation' : 'product',
|
||||
'type' => 'product_variation' === $query_result->post_type ? 'variation' : 'simple',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue