# Disable the Persistent Cart

> Stops WooCommerce from saving logged-in customers' carts to their account between sessions, so each visit starts with an empty cart.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, cart, sessions
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-disable-persistent-cart/

## Code

```php
add_filter( 'woocommerce_persistent_cart_enabled', '__return_false' );
```

## Notes

Guests are not affected because their carts are stored in a session cookie.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Disable the Persistent Cart" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
