> Documentation index: [Saleor](/llms.txt) · [This section](/developer/llms.txt)
> Source: https://docs.saleor.io/developer/order/order-expiration

# Order Expiration

Orders may expire to prevent inventory from being blocked and the system from being cluttered with outdated or abandoned orders.

Once an unpaid order is created (via [`checkoutComplete`](/api-reference/checkout/mutations/checkout-complete.md) or [`orderCreateFromCheckout`](/api-reference/orders/mutations/order-create-from-checkout.md)), 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.

Saleor allows finalizing checkout without payment. This can be achieved in two ways:

-   by setting [`orderSettings.allowUnpaidOrders`](/api-reference/miscellaneous/objects/order-settings.md#allow-unpaid-orders) for a given `Channel` to `true` and calling [`checkoutComplete`](/api-reference/checkout/mutations/checkout-complete.md) without any [`Payment`](/api-reference/payments/objects/payment.md)/[`TransactionItem`](/api-reference/payments/objects/transaction-item.md) object
-   by calling the protected mutation [`orderCreateFromCheckout`](/api-reference/orders/mutations/order-create-from-checkout.md) without any [`Payment`](/api-reference/payments/objects/payment.md)/[`TransactionItem`](/api-reference/payments/objects/transaction-item.md) 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.

<a id="configuration"></a>

## Configuration

To set the expiration of orders, specify the number of minutes after which the orders should expire by setting [`expireOrdersAfter`](/api-reference/miscellaneous/objects/order-settings.md#expire-orders-after). Additionally, the [`deleteExpiredOrdersAfter`](/api-reference/miscellaneous/objects/order-settings.md#delete-expired-orders-after) 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**

```graphql
mutation ChannelUpdate($id: ID!, $input: ChannelUpdateInput!) {
  channelUpdate(id: $id, input: $input) {
    channel {
      id
      orderSettings {
        expireOrdersAfter
        deleteExpiredOrdersAfter
      }
    }
    errors {
      field
      code
      message
    }
  }
}
```

**Variables**

```json
{
  "id": "Q2hhbm5lbDoyMjQz",
  "input": {
    "orderSettings": {
      "expireOrdersAfter": 360,
      "deleteExpiredOrdersAfter": 30
    }
  }
}
```

**Result**

```json
{
  "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.

<a id="how-to-disable-order-expiration"></a>

## 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.
