Fix; wrong method calls

This commit is contained in:
Mike Jolley 2017-02-08 16:19:13 +00:00
parent c63cec32b9
commit af6ee6d420
1 changed files with 2 additions and 2 deletions

View File

@ -1236,7 +1236,7 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
if ( isset( $request['stock_quantity'] ) ) {
$product->set_stock_quantity( wc_stock_amount( $request['stock_quantity'] ) );
} elseif ( isset( $request['inventory_delta'] ) ) {
$stock_quantity = wc_stock_amount( $product->get_stock_amount() );
$stock_quantity = wc_stock_amount( $product->get_stock_quantity() );
$stock_quantity += wc_stock_amount( $request['inventory_delta'] );
$product->set_stock_quantity( wc_stock_amount( $stock_quantity ) );
}
@ -1441,7 +1441,7 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
if ( isset( $data['stock_quantity'] ) ) {
$variation->set_stock_quantity( $data['stock_quantity'] );
} elseif ( isset( $data['inventory_delta'] ) ) {
$stock_quantity = wc_stock_amount( $variation->get_stock_amount() );
$stock_quantity = wc_stock_amount( $variation->get_stock_quantity() );
$stock_quantity += wc_stock_amount( $data['inventory_delta'] );
$variation->set_stock_quantity( $stock_quantity );
}