Merge pull request woocommerce/woocommerce-admin#2546 from woocommerce/fix/variations-low_stock_amount
Stock notifs: fix low_stock_amount for variations
This commit is contained in:
commit
a1a4e04c1f
|
@ -120,9 +120,12 @@ class WC_Admin_REST_Products_Controller extends WC_REST_Products_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_object_for_response( $object, $request ) {
|
public function prepare_object_for_response( $object, $request ) {
|
||||||
$data = parent::prepare_object_for_response( $object, $request );
|
$data = parent::prepare_object_for_response( $object, $request );
|
||||||
if ( $request->get_param( 'low_in_stock' ) && is_numeric( $object->low_stock_amount ) ) {
|
$object_data = $object->get_data();
|
||||||
$data->data['low_stock_amount'] = $object->low_stock_amount;
|
|
||||||
|
if ( $request->get_param( 'low_in_stock' ) && is_numeric( $object_data['low_stock_amount'] ) ) {
|
||||||
|
$data->data['low_stock_amount'] = $object_data['low_stock_amount'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue