Order Expiration
Saleor allows finalizing checkout without payment. This can be achieved in two ways:
- by setting
orderSettings.allowUnpaidOrders
for a givenChannel
totrue
and callingcheckoutComplete
without anyPayment
/TransactionItem
object - by calling the protected mutation
orderCreateFromCheckout
without anyPayment
/TransactionItem
object.
If the order remains unpaid for some time, it is possible to set automatic stock releases and remove the order. Saleor will first mark orders as expired and later will remove those orders.
Configuration
To set the expiration of orders, specify the number of minutes after which the orders should expire by setting expireOrdersAfter
.
Additionally, the deleteExpiredOrdersAfter
value can be modified. By default, this is set to 60 days, but it can be changed to anywhere between 1 and 120 days.
mutation ChannelUpdate {
channelUpdate(
id: "Q2hhbm5lbDoyMjQz"
input: {
orderSettings: { expireOrdersAfter: 360, deleteExpiredOrdersAfter: 30 }
}
) {
channel {
id
orderSettings {
expireOrdersAfter
deleteExpiredOrdersAfter
}
}
errors {
field
code
message
}
}
}
{
"data": {
"channelUpdate": {
"channel": {
"id": "Q2hhbm5lbDoyMjQz",
"orderSettings": {
"expireOrdersAfter": 360,
"deleteExpiredOrdersAfter": 30
}
},
"errors": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 0,
"maximumAvailable": 50000
}
}
}
In the above example, orders will expire after 360 minutes (6 hours), and after 30 days Saleor will remove those orders.
How it works
Once an unpaid order is created (via checkoutComplete
or orderCreateFromCheckout
), it remains in UNCONFIRMED
status. If the customer does not complete the payment within expireOrdersAfter
minutes after that, the status will change to EXPIRED
and stock allocation will be released.
After deleteExpiredOrdersAfter
days orders in EXPIRED
status will be deleted and disappear from the order list.
How to disable order expiration
To disable order expiration, set expireOrdersAfter
to 0.
When expireOrdersAfter
is set to 0, the orders will not expire. Since there will be no orders with the status EXPIRED
, Saleor will not automatically delete such orders.