Developer forum

Forum » Ecommerce - Standard features » Losing carts for logged in users

Losing carts for logged in users

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

We have a high-volume site where users seem to lose their cart. Here's what we're seeing:

1. Log in
2. Create a cart
3. Confirm there's a cart ID stored in the cache in the key DW_extranet_AccessUserCartID
4. Wait a bit
5. Reload the page

Now the cart is gone and so is the cache key.

Initially, this process would happen after a minute or so. We then added more RAM to the site and now the problem occurs less frequent.

We did a lot of debugging of standard and custom code, but can't find anything.

Could this be related to the MemoryCache used in CartSession (MemoryCacheManager)? The default duration for the cache key is 12 hours, but could it be that items are ejected from the cache earlier due to memory pressure? It seems that Cache for these keys is a bit risky. Or is the key also stored elsewhere like Session and I am not seeing it?

We did some debugging and it seems the DynamicWeb MemoryCache instance has around 10K items with a total size of 490 MB (at the moment, it fluctuates a lot).

Thanks!

Imar


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Imar,

I will take a closer look at the issue and see if I can reproduce it... and find a fix and/or workaround.

  1. Which version of DW is that?
  2. Can you also provide a screen dump of the shopping cart settings (Settings > Ecommerce > Advanced configuration > Shopping Cart)?

/Morten

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Morten,

We're running on 9.16.4. And here's the screenshot:

 

Note, we set 720 for the session timeout ourselves at some point. We had the same isue when it was still empty (in which case the default from CartSession was used)

Thanks!

Imar

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Imar,

I tried to reproduce the issue with the settings and the steps that you provided, but unfortunately I wasn't able to do so.

I also tried to make a local change to CartSession, so that it would always return null, but everything still worked, since we will then attempt to load the cart based on the cart cookie instead.

  1. Is the cart cookie being set as expected, e.g. "Dynamicweb:Ecom:Cart13" (where 13 is the current user id)?
    Note: If you manually log off the cookies will be removed.
     
  2. Could someone else be making changes to the same cart at the same time?
    Maybe someone else could be logged in as the same user (or impersonating the user) and make changes to the cart?
     
  3. Could there be an integration job or some custom code which changes the user cart relation (AccessUser.AccessUserCartId)?
     
  4. Some errors have been logged to the files in /Files/System/eCom/Order, e.g. "Save Order problem. Invalid state, saving: CART36786", which seems to involve a custom template.
    The errors indicate that some carts have been marked as complete.
    Maybe adding some logging to the custom code could be helpful?
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Morten,.

Thanks for your reply. Answers below:

>> 1. Is the cart cookie being set as expected, e.g. "Dynamicweb:Ecom:Cart13" (where 13 is the current user id)?

Nope, not always which has confused me a little bit. At least not on my machine. Once I log in I see these cookies:

I verified cookie consent and that looks OK. Any idea why trhe cookie could not be set?

>> 2. Could someone else be making changes to the same cart at the same time?

I don't think so. It could be on our test account, but customers are also reporting this.

>> 3. Could there be an integration job or some custom code which changes the user cart relation (AccessUser.AccessUserCartId)?

None of the jobs we have are order or cart related.

>> 4. Some errors have been logged to the files in /Files/System/eCom/Order, e.g. "Save Order problem. Invalid state, saving: CART36786", which seems to involve a custom template.

Will take a look, thanks.

 

 

You must be logged in to post in the forum