clearing cart when closing browser

Hi All

Is there any way to clear the shopping cart when closing the browser, ie if a customer adds to the cart but does not go to checkout, when they come back onto the site they get a empty cart. I guess its clearing the cache on close down for the cart view ??



Posted: Jan 22, 2012


rfay Randy Fay on January 23, 2012

Drupal has a way to basically throw away the session cookie when the browser is closed. You might try it in settings.php:

* Set session cookie lifetime (in seconds), i.e. the time from the session is
* created to the cookie expires, i.e. when the browser is expected to discard
* the cookie. The value 0 means "until the browser is closed".
ini_set('session.cookie_lifetime', 0);

ikmps on January 23, 2012


I have added this to this to the end of settings.php, cleared the cache on drupal and cleared the cache on the broswer. It clears when you open a "in private" broswer but not in a normal browser.



rfay Randy Fay on January 23, 2012

You have to *exit* the browser... This doesn't take effect on just closing a window.

I've used this for years on a membership site that's often used in libraries, and it worked fine for that.