From c5247a8c4b255cc8bf6b151944aeaf3578a1602d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demarle?= Date: Thu, 23 Feb 2017 16:54:04 +0100 Subject: [PATCH] Fix call to deprecated methods in ajax reduce/increase stock responses --- includes/class-wc-ajax.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-ajax.php b/includes/class-wc-ajax.php index 5a92fbdcb0e..412092454ee 100644 --- a/includes/class-wc-ajax.php +++ b/includes/class-wc-ajax.php @@ -932,7 +932,7 @@ class WC_AJAX { $_product = $order_item->get_product(); if ( $_product->exists() && $_product->managing_stock() && isset( $order_item_qty[ $item_id ] ) && $order_item_qty[ $item_id ] > 0 ) { $stock_change = apply_filters( 'woocommerce_reduce_order_stock_quantity', $order_item_qty[ $item_id ], $item_id ); - $new_stock = $_product->reduce_stock( $stock_change ); + $new_stock = wc_update_product_stock( $_product, $stock_change, 'decrease' ); $item_name = $_product->get_sku() ? $_product->get_sku() : $_product->get_id(); $note = sprintf( __( 'Item %1$s stock reduced from %2$s to %3$s.', 'woocommerce' ), $item_name, $new_stock + $stock_change, $new_stock ); $return[] = $note; @@ -972,7 +972,7 @@ class WC_AJAX { if ( $_product->exists() && $_product->managing_stock() && isset( $order_item_qty[ $item_id ] ) && $order_item_qty[ $item_id ] > 0 ) { $old_stock = $_product->get_stock_quantity(); $stock_change = apply_filters( 'woocommerce_restore_order_stock_quantity', $order_item_qty[ $item_id ], $item_id ); - $new_quantity = $_product->increase_stock( $stock_change ); + $new_quantity = wc_update_product_stock( $_product, $stock_change, 'increase' ); $item_name = $_product->get_sku() ? $_product->get_sku() : $_product->get_id(); $note = sprintf( __( 'Item %1$s stock increased from %2$s to %3$s.', 'woocommerce' ), $item_name, $old_stock, $new_quantity ); $return[] = $note;