Showstopper: Different users getting the same cart token

Shopify Partner
28 0 3

Hi all,

I have a client (whose site I did not develop, but am now the developer for) who uses the AJAX API to add products to the cart, using the code nearly verbatim from https://github.com/carolineschnapp/ajaxify-cart

I've been able to repeatedly reproduce a bug that their customer service team has had reported from customers-- namely, if you add the same thing (product with exact variants) to your cart as another user with an active session who is also adding that product to their cart, then both users end up with the same cart token.

The reproduction scenario is as follows:

USER1 adds product1 with variant1a and variant 2a to their cart. They are assigned a unique cart token (verified at shopname.com/cart.json) and continue to browse the store.

USER2 adds product1 with variant1a and variant2a to their cart. They get the same token as USER1. When USER1 returns to the cart they notice the product now has a qty 2 instead of 1, even though they just put 1 in their cart.

Since the store does not pass any attempt at setting a token, only adding the product to the cart (and setting a cookie to remember the variant selection if the user returns), it would appear that there's a bug in the API or backend which sees two different users with the same cart as the same user and reassigns those two users the same token.

My question is, has anyone seen this before, and will anyone at Shopify take a look? Normal support channels defer all API related issue to the forum.

thanks!

Paolo

Hidden Gears: Web Design, Development + Digital Marketing
0 Likes
Shopify Staff
Shopify Staff
591 0 45

How are you testing this functionality? Is this with two separate browser sessions running in Incognito / Privacy mode? Have you replicated this across computers? Across Browsers?

0 Likes
Shopify Partner
28 0 3

I reproduced it with one browser in Chrome incognito and the other in Safari, after noticing oddities while browser testing other features I was developing. It's been reproduced by their staff (different people in different states), and also reported by customers over time.

Here's a screenshot of my Chrome and Safari browsers side by side:

Hidden Gears: Web Design, Development + Digital Marketing
0 Likes
Highlighted
Shopify Staff
Shopify Staff
591 0 45

Cool. Thanks.

We've pinpointed the issue and have some engineers looking into it. We'll update this post when it's been resolved.

0 Likes
Shopify Partner
28 0 3

Awesome, thank you Chris, looking forward to it!

Hidden Gears: Web Design, Development + Digital Marketing
0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
59 0 13

Hi Paolo,

Just wanted to let you know we are still looking into this issue.

I will keep you updated as soon as the fix is deployed.

- Christian

0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
59 0 13

Hi Paolo,

This should be fixed.

I can no longer reproduce the bug on my shop using two browsers and running:

jQuery.post('/cart/add.js', {quantity:1, id: 269413294});

I've confirmed both browsers see different cart tokens.

- Christian

0 Likes
Shopify Partner
28 0 3

That's excellent Christian! I'll go through and test now and see if I can reproduce and let you know if for some reason it's not fixed. Thanks so much!

-Paolo

Hidden Gears: Web Design, Development + Digital Marketing
0 Likes
Shopify Partner
28 0 3

Hi Christian,

It looks like we're still getting weird behavior with quantities greater than one. In one instance we found that if one user added 3 to the cart and another user added 5, the second user ended up with qty 15 in the cart... any ideas?

Hidden Gears: Web Design, Development + Digital Marketing
0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
59 0 13

Hi Paolo,

Have you been able to reliably reproduce this? If so, can you share the steps with me?

I'm not seeing this on my end.

Thanks,

- CJ

0 Likes