Merge pull request #24699 from sisou/patch-1

Correct comments in stock increase methods
This commit is contained in:
Vedanshu Jain 2019-10-02 17:27:10 +05:30 committed by GitHub
commit bea65d43dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -121,16 +121,16 @@ function wc_maybe_increase_stock_levels( $order_id ) {
}
$stock_reduced = $order->get_data_store()->get_stock_reduced( $order_id );
$trigger_reduce = (bool) $stock_reduced;
$trigger_increase = (bool) $stock_reduced;
// Only continue if we're reducing stock.
if ( ! $trigger_reduce ) {
// Only continue if we're increasing stock.
if ( ! $trigger_increase ) {
return;
}
wc_increase_stock_levels( $order );
// Ensure stock is marked as "reduced" in case payment complete or other stock actions are called.
// Ensure stock is not marked as "reduced" anymore.
$order->get_data_store()->set_stock_reduced( $order_id, false );
}
add_action( 'woocommerce_order_status_cancelled', 'wc_maybe_increase_stock_levels' );
@ -261,7 +261,7 @@ function wc_increase_stock_levels( $order_id ) {
continue;
}
// Only reduce stock once for each item.
// Only increase stock once for each item.
$product = $item->get_product();
$item_stock_reduced = $item->get_meta( '_reduced_stock', true );