How to reduce the stock for specific order status in WooCommerce
问题 I am managing my stock on WooCommerce. I would like to reduce the stock when the order status changes to a specific status for example (pending) or other status. So I used this code: function manageStock ($order_id, $old_status, $new_status, $instance ) { if ($old_status === 'on-hold'){ wc_reduce_stock_levels($order_id); } } add_action( 'woocommerce_order_status_changed', 'manageStock', 10, 4 ); But unfortunately does not work. Is there another way to solve this problem? 回答1: Stock is already