REST API: Check if stock should be adjusted when updating order line items (#47784)
* Check for stock adjustment during REST order update request * Add changelog file
This commit is contained in:
parent
9cd84a44cb
commit
403ff183e0
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Ensure available stock is updated correctly when updating line items in orders via the REST API.
|
|
@ -930,6 +930,11 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller {
|
||||||
$this->maybe_set_item_props( $item, array( 'name', 'quantity', 'total', 'subtotal', 'tax_class' ), $posted );
|
$this->maybe_set_item_props( $item, array( 'name', 'quantity', 'total', 'subtotal', 'tax_class' ), $posted );
|
||||||
$this->maybe_set_item_meta_data( $item, $posted );
|
$this->maybe_set_item_meta_data( $item, $posted );
|
||||||
|
|
||||||
|
if ( 'update' === $action ) {
|
||||||
|
require_once WC_ABSPATH . 'includes/admin/wc-admin-functions.php';
|
||||||
|
wc_maybe_adjust_line_item_product_stock( $item );
|
||||||
|
}
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue