WooCommerce 11.0 introduces a significant change in stock management: when an order transitions to ‘failed’, any previously reduced stock is now automatically restored. This impacts how inventory is managed for online stores, particularly those using custom workflows.
Key Takeaways
- Stock is now restored for failed orders in WooCommerce 11.0.
- No action needed for most stores; only affected if using failed status differently.
- Review custom workflows to ensure stock management aligns with new behavior.
How the New Feature Works
Previously, stock was only restored when an order moved to ‘cancelled’ or ‘pending’, but not when it failed. With the new update, if an order that reduced stock goes to failed, WooCommerce will restore that stock automatically. This change is implemented via the wc_maybe_increase_stock_levels() function, which checks if stock was reduced before making adjustments.
Who May Be Affected
Store owners and developers who have workflows relying on failed orders keeping stock reduced should review their processes. This is especially important for those using the failed status for non-payment scenarios, as stock will now be restored unless specific hooks are removed.
Recommendations for Developers
If your extension uses the failed status for payment failures, no changes are necessary. However, if you utilize failed status for other reasons and need stock to remain reduced, you must remove the new stock restoration hook. Testing is crucial to ensure that your order statuses and stock management align with the new behavior.
Frequently Asked Questions
What happens to stock when an order goes to ‘failed’ in WooCommerce 11.0?
Stock is automatically restored if it was previously reduced.
Do I need to change my WooCommerce settings for failed orders?
Most stores do not need to change settings unless using failed status for non-payment.
Who should review their workflows due to this change?
Store owners and developers relying on failed orders to keep stock reduced should review their processes.
What should developers do if they use failed status for other reasons?
They must remove the new stock restoration hook to keep stock reduced.