All things Shopify and commerce
Hello.
We are getting this error when trying to add items to the cart using IOS.
Our site is: https://pinnovators.myshopify.com/
"There Was An Error While Updating Your Cart. Please try again."
I'm not a serious coder so not really able to make serious edits to our store but any help about what is causing this would be appreciated. Everything used to work in IOS until 5-6 months ago so I'm not sure if something changed with IOS that broke Shopify.
Thanks,
Mark
Have you installed any new apps?
Here is an explanation:
Your theme uses a jQuery library. It's a part of vendor.js asset and is version 2.2.3
It's a popular library and many apps use it too. Some apps use older versions of jQuery, some -- newer.
Nice apps check if there is jQuery loaded and if not -- load their own.
Ideally, it should happen like this:
However, since modern browsers are able to load multiple files at the same time, it may happen that the order is different:
Result -- theme has to use the wrong version of jQuery.
This is what happens when your site is visited on the iPhone as it may be slower than desktop or IOS Safari has different loading strategy.
In your case, instead of jQuery version 2.2.3 theme has to use version 1.9.1 (loaded by Topbar -- but it's not the apps fault!). And they are not fully compatible.
There are several ways to fix this.
The simplest is to ensure that vendor.js is always loaded earlier than apps.
Try this:
It should look similar to
<script src="{{ 'vendor.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'theme.js' | asset_url }}" defer="defer"></script>
4. Remove the defer="defer" from both lines
5. Save and try your modified theme in preview.
The attribute instructs browsers to load this JS file later and is one of the reasons while loading sequence may be off.
By removing the attribute we instruct browser to load it immediately -- this may make it a bit less efficient, but we really want to ensure that it loads early.
It may be enough to remove it from vendor.js line only, but I'd recommend removing it from both just in case.
Finally, this may still not fix it -- I've seen Apps which are not nice and simply load their own copy of jQuery regardless -- this may need further investigation.
Hopefully in your case it would be enough.
Hi Tim.
Thank you for taking a look at this issue. I appreciate it!
After I posted this issue, I tried contacting Shopify for help. The response time to my issue was amazing! The case got escalated and Brendan helped with the issue. Here is a snippet of his response.
"I have narrowed down the cause to an (app) called AAA Web Push and Announcement which has been active on your store since 2019. While you may not have made any changes to this app's settings, sometimes it's necessary for app developers to update the files that your store connects to when using their app, and it looks to me like an update on the app's side has caused this issue. It's a strange one, though disabling this app's connection to your store very definitely resolves the issue."
Brendan alerted the app developer to the issue, and they contacted me. I sent them a copy of your information to see if it helps them determine if they have a problem with their app.
Let's see what happens!
Thanks again,
Mark
Any update? Same problem here with Debute theme. It started a few days ago , IOSS and Mac. Any idea which app causes this problem...
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024