Cart is empty after returning from checkout with back button

DiscountNinja
Shopify Partner
104 0 65

While testing Shopify's checkout process on development stores we routinely run into a situation where the cart suddenly becomes empty.

 

More often than not this happens when navigating from the checkout to the cart using the back button.

Using the back button to go to the cart instead of using the "return to cart" links may be part of what causes this behavior. In the video link you find below you'll see that I reproduced this issue on a brand new development store without any apps installed. Other factors that may contribute: we typically have the admin of the shop open, we also typically have multiple tabs open with the product page/cart or checkout of one or more development stores.

 

Does anybody at Shopify have an idea what could be causing this and if this could indeed affect shop visitors?

Here's a video that shows how the issue reproduced on my machine: https://www.loom.com/share/69eb9e55646a4056b5992bf606f03e0a

 

This issue is important to us since our app uses DraftOrders to create a checkout. That checkout unfortunately does not contain a "return to cart" button, so visitors have to use the back button if they want to go back to the cart. That means the risk that visitors run into this "empty cart" issue is real.

Bart Coppens | Limoni Apps | Building apps for Shopify since 2016
Replies 11 (11)

Josh
Shopify Staff
1134 84 233

Hey @DiscountNinja , 

 

Wow - that is interesting. It took me about ~25 tries or so, but I was finally able to replicate it once. Would you be able to create a ticket from your Partner Dashboard about this? I think you may have done this before, but just for reference in case - if you click 'Support' in the sidebar in your Partner Dashboard and then click the 'Email support' option, as long as you use the 'App development' topic it should create a ticket that I can grab and I'll get our core technical team looking into this. 

 

I would suggest referencing me by name within your message so we can make sure this ends up in the right hands. 

Josh | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

DiscountNinja
Shopify Partner
104 0 65

Created a support ticket via the partner portal.

Bart Coppens | Limoni Apps | Building apps for Shopify since 2016
Josh
Shopify Staff
1134 84 233

Thanks Bart, got it - I'll get this to the right people today so they can investigate further and let you know their findings.

Josh | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

DiscountNinja
Shopify Partner
104 0 65

@Josh I found others reporting the same issue with the cart disappearing

This article, while posted on a CartJs forum, actually concludes the behavior is likely caused by Shopify's caching implementation: https://github.com/discolabs/cartjs/issues/158

They suggest this could be a CloudFlare / page caching issue whereby the cart json is actually cached in the page, causing issues.

 

This issue, in combination with the fact that the Checkout API does not allow for displaying a "return to cart" link on a custom checkout, is quite worrying.

Can you relay this information to the relevant team please?

 

Bart Coppens | Limoni Apps | Building apps for Shopify since 2016
Josh
Shopify Staff
1134 84 233

Hey @DiscountNinja , 

 

Consider it relayed! Thanks for following up. 

Josh | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Janna2
Visitor
1 0 1

Does anyone have an update on this issue? We have Retina theme and have been experiencing this issue for quite some time. I'm anxious to have it resolved before the holiday shopping season. I've reached out to Retina to no avail so far. Any other advice? 

Jon-FDG
Visitor
1 0 0

I have also experienced this issue with the Empire shopify theme. Looks like it has to do with browsers caching the cart data. 

I tried adding <meta http-equiv='cache-control' content='no-cache'> to my site's header but it didn't improve the issue.



DiscountNinja
Shopify Partner
104 0 65

In my experience, it seems to happen almost 100% of the time when I make a change to the theme.

I'm assuming therefore that this is a problem that mostly impacts developers and doesn't have an impact on merchants.

 

Example:

- Add a product to cart and check out

- Change a liquid file

- Go back to cart: cart is empty

Bart Coppens | Limoni Apps | Building apps for Shopify since 2016
andrewbui
Tourist
3 0 1

I am having the same issue with joynerlucas.com. I am using the brooklyn theme. I've had shopify support look into this and they are unable to identify the problem after checking our theme/coding/apps. Clearing the browsing data seems to fix this, but we can't expect our customers to know to do this. Has anyone found a more permanent solution?

Eefje
Visitor
2 0 1

Has there been ANY update / fix for this issues since it was posted 3(!) years ago? Because this is still very much happening, and not just once or twice, it happens with every single order. 

MaroseVela
Visitor
1 0 1

Hi! Any news on this issue?

 

We experience the same problem on every order, no matter the device or product. When a customer adds a product to cart and goes to the previous page by swiping right on an iphone or hitting the 'previous' button in the browser the entire cart gets cleared completely. This issue is costing us.