Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added woocommerce_reduce_order_item_stock action hook to let other plugin hook functionalities without looping through the order items again and again. #34721

Merged
merged 3 commits into from Mar 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions plugins/woocommerce/includes/wc-stock-functions.php
Expand Up @@ -202,6 +202,16 @@ function wc_reduce_stock_levels( $order_id ) {
'from' => $new_stock + $qty,
'to' => $new_stock,
);

/**
* Fires when stock reduced to a specific line item
*
* @param WC_Order_Item_Product $item Order item data.
* @param WC_Product $product Line item product.
* @param WC_Order $order Order data.
* @since 7.0.0
*/
do_action( 'woocommerce_reduce_order_item_stock', $item, $product, $order );
}

wc_trigger_stock_change_notifications( $order, $changes );
Expand Down