WooCommerce 11.0 will change how stock is handled when an order moves to the failed status. If an order previously reduced product stock and later transitions to failed, WooCommerce now restores that stock automatically.
This change was made by hooking wc_maybe_increase_stock_levels() to the woocommerce_order_status_failed action.
For most stores and extensions, no action is required. The new behavior only restores stock for orders that actually reduced stock. Stores and extensions that use the failed order status for non-payment workflows should review their order-status handling and inventory expectations.
What changed
Before WooCommerce 11.0, WooCommerce restored reduced stock when an order moved to cancelled or pending, but not when it moved to failed.
That meant an order could reduce stock while it was on-hold, later move to failed, and keep the stock reduced indefinitely. This was most visible with asynchronous payment methods: a payment can be accepted for processing, the order can move to on-hold and reduce stock, and the payment can later be rejected so the order ends as failed.
Starting in WooCommerce 11.0, WooCommerce also restores reduced stock when an order transitions to failed:
add_action( 'woocommerce_order_status_failed', 'wc_maybe_increase_stock_levels' );The restore still goes through wc_maybe_increase_stock_levels(). That function checks whether stock was previously reduced for the order before changing inventory. In practice, this means:
- An
on-holdorder that reduced stock and then moves tofailedwill restore the stock. - A
pendingorder that never reduced stock and then moves tofailedshould not change stock. - If an admin or extension later moves the failed order back to a paid status, WooCommerce can reduce stock again without double-reducing from the earlier order state.
This change does not alter WooCommerce’s separate checkout stock-reservation behavior. It affects actual stock reduction and restoration for orders that carry the stock-reduced flag.
Who may be affected
Review your code if your store, extension, or integration relies on failed orders keeping stock reduced.
This is most relevant for custom workflows that repurpose the failed status for non-payment cases. For example, a store might mark an order as failed when delivery fails, while still treating the goods as committed or in transit. With WooCommerce 11.0, moving that stock-reduced order to failed will restore the product stock unless the new hook is removed or custom stock handling is added.
What developers should do
If your extension uses the failed status for payment failures, or if it does not rely on failed orders keeping stock reduced, no change should be needed.
If your extension intentionally uses the failed status for non-payment workflows and needs stock to remain reduced, remove the new stock-restoration hook:
remove_action( 'woocommerce_order_status_failed', 'wc_maybe_increase_stock_levels' );Run this only if your site or extension has a clear reason to preserve the old behavior.
Before shipping updates, test any custom order-status path that moves an order through on-hold, processing, completed, or failed, and confirm that product stock, order notes, and the stock-reduced flag match your intended workflow.
Leave a Reply