pythondjangodjango-oscar

For how long does OSCAR save a user basket


Users report their basket being deleted the day after they added products to it, other times it lasts for more than two days.

There doesn't seem to be any saved cookie apart from a session ID and a CSRF token and I couldn't find a function that actively deletes users' baskets after a specific amount of time.

I would like to increase the time OSCAR saves baskets to a month but all I could find in the source is a reference to a cookie set for "7 x 24 x 60 x 60", which would mean a week.


Solution

  • If you look into Oscar's Settings it has the OSCAR_BASKET_COOKIE_LIFETIME set to 604800 (One week). You can refer it here Oscar Settings for Basket.
    If you want these cookies to last for a month you would set this in your settings:

    OSCAR_BASKET_COOKIE_LIFETIME = 2592000 # 60 * 60 * 24 * 30 = 30 days
    

    Regarding customers losing their basket in a day most likely they are clearing cookies / changing browsers etc. While a logged in customer should not be losing their basket.