<p>Create a <code>commerce.php</code> config file in your <code>config</code> folder and set the <code>cartCookieDuration</code> to a time interval. The default is 3 months.</p>

<pre><code>&lt;?php
return [
    'cartCookieDuration' =&gt; 'P3M',
    'purgeInactiveCarts' =&gt; true,
    'purgeInactiveCartsDuration' =&gt; 'P3M',
];
</code></pre>

CC BY-SA 4.0
2019-07-25T23:16:19.747Z
Oh that's very helpful!  Thank you!
biko
CC BY-SA 4.0
2019-07-25T03:48:35.933Z
2019-07-25T03:48:35.933Z
Luke Holder
<p>Is it possible to change the cookie timeout just for the cart?  E.g. I'd like to clear abandoned carts after X hours and keep all the other sessions untouched (e.g. user sessions etc).</p>

<p>Please advise anyone!</p>

<plugin-craftcommerce><craft2><session><cookies><timeout>
Craft 2 Commerce 1 cart session expiry
# Craft 2 Commerce 1 cart session expiry

(Asked by: username_0 on 2019-07-25)

Is it possible to change the cookie timeout just for the cart? E.g. I'd like to clear abandoned carts after X hours and keep all the other sessions untouched (e.g. user sessions etc).

Please advise anyone!

**Tags:** plugin-craftcommerce, craft2, session, cookies, timeout


---

## 1 answers

### Answer by username_1 on 2019-07-25. Score: 2 | Accepted answer

Create a commerce.php config file in your config folder and set the cartCookieDuration to a time interval. The default is 3 months.
 'P3M',
    'purgeInactiveCarts' => true,
    'purgeInactiveCartsDuration' => 'P3M',
];

> **Comments:**
> **username_0**: Oh that's very helpful!  Thank you!  

---

