> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-commerce/how-to-guides/configuring-cart-cleanup.md).

# Configuring Cart Cleanup

{% hint style="info" %}
Available from Umbraco Commerce 15.1.0
{% endhint %}

By default Umbraco Commerce will keep all created carts indefinately. Over time this can become an issue. To assist with this is it possible to configure a cart cleanup routine to delete carts older than a pre-configured time interval.

This service can be enabled and configured in the `appSettings.json`

```json
{
    "Umbraco" : {
        "Commerce": {
            "CartCleanupPolicy": {
                "EnableCleanup": true,
                "KeepCartsForDays": 800,
                // Optional settings
                "FirstRunTime": "* 4 * * *",
                "Period": "1.00:00:00",
                "PerStorePolicies": {
                    "{STORE_ALIAS}": {
                        "KeepCartsForDays": 800,
                    }
                }
            }
        }
    }
}
```

The configuration supports the followin keys.

| Key                                               | Description                                                                                                    |
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `EnableCleanup`                                   | Enables or disabled the cart cleanup service. `false` by default.                                              |
| `KeepCartsForDays`                                | The number of days to keep carts after the carts last modification date.                                       |
| `FirstRunTime`                                    | The time to first run the scheduled cleanup task, in crontab format. If empty, runs imediately on app startup. |
| `Period`                                          | How often to run the task, in timespan format. Defaults to every 24 hours.                                     |
| `PerStorePolicies`                                | Define store specific policies.                                                                                |
| `PerStorePolicies.{STORE_ALAIS}.KeepCartsForDays` | The number of days to keep carts after the carts last modification date for the given store.                   |

## Cart Conversion Rates Widget

When enabling the cart cleanup service, it's important to know that this can affect the cart conversion rates widget in the analytics section. If the widget is configured to show a time period that exceeds the cleanup policies time frame then a warning will be displayed.

![Cart Conversion Rate date range exceeds the cart cleanup policy configuration warning](/files/kjragDNFdfNNgaSk8H0Y)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.umbraco.com/umbraco-commerce/how-to-guides/configuring-cart-cleanup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
