August 11, 2026 · 6 min read
How to Automatically Cancel Unpaid Magento Orders (And Free Up the Stock)
A customer starts checkout, picks a bank transfer or offline payment method, and never actually pays. The order sits in pending forever — cluttering the order grid, and, less visibly, holding its reserved stock indefinitely against inventory that a paying customer could otherwise buy.
The part that doesn't show up in the order grid
When an order is placed, Magento's inventory reservation system deducts the ordered quantity from salable stock immediately — before payment, before invoice, before anything confirms the order will actually go through. That's correct behavior for a normal order that gets paid quickly. It's a problem for an order that never gets paid, because nothing in core reverses that reservation on its own. The stock stays held against an order that may never complete, and core ships no cron job that goes looking for orders like this.
Cancelling manually works, but it means someone has to notice the order, verify nothing was paid on it, and cancel it by hand — a task that scales badly once a store has enough offline or delayed-payment orders that a handful are always sitting unpaid at any given time.
What the scheduled cleanup does
The module runs on a schedule and looks for orders that are unpaid past a configurable age threshold — you decide what "too long" means for your store, whether that's a few hours for a fast-moving catalog or a few days for a business that expects slower offline payment cycles. Matching orders get cancelled automatically, and Magento's own inventory reservation logic releases the held quantity back to salable stock as part of that cancellation — the same release that happens on any manual cancel.
- Age threshold is configurable, not hardcoded — set it to match how your store actually processes payments.
- Runs on a schedule via cron, no manual trigger needed once it's configured.
- Released stock becomes salable again immediately, the same as a manual cancellation.
- Optional email notification to the customer when their order is auto-cancelled, so it doesn't look like their order simply vanished.
It never touches a paid order. Any order with an invoice or payment recorded against it — even a partial payment — is excluded from the cancellation sweep entirely. The rule is deliberately conservative: if there's any money on the order, it's left alone for a human to handle. And if cancelling one order in a batch fails for some reason, that failure doesn't stop the rest of the batch from processing — one bad order can't block the whole cleanup run.
Unpaid orders cancelled on schedule, stock released automatically.
Get Order Auto-Cancel — free