Automatic stock restoration
WooCommerce reduces stock when an order is placed, but does not always restore it on cancellation. This module automatically restores the stock.
Enabling
Section titled “Enabling”Go to WooCommerce > Polski > Modules and enable the Auto Restore Stock module in the “Stock & Cart” section.
Supported status transitions
Section titled “Supported status transitions”| From status | To status | Restoration |
|---|---|---|
| Processing | Cancelled | Yes |
| Completed | Cancelled | Yes |
| On-hold | Cancelled | Yes |
| Processing | Refunded | Yes |
| Completed | Refunded | Yes |
| On-hold | Refunded | Yes |
| Processing | Failed | Yes |
| On-hold | Failed | Yes |
How it works
Section titled “How it works”- The order changes its status to cancelled/refunded/unpaid
- The module checks each product in the order
- For products with stock management enabled, it restores the quantity
- It adds a note to the order: “Stock restored: Product name (5 -> 8)”
- It sets the
_polski_stock_restoredmeta to prevent double restoration
Requirements
Section titled “Requirements”- The WooCommerce Manage stock option must be enabled
- Products must have stock management enabled
| Hook | Type | Description |
|---|---|---|
polski/stock/restored | action | After stock is restored for a product |