500+ Line Items Wipes Cart

Short description of issue

Adding items to your cart to push it over 500 unique lines simply wipes the cart rather than reporting back a Cart API error..

Link to Shopify Store

N/A

Reproduction steps

Add 499 Line Items to the cart
Add 2 more
Watch as your entire basket empties

Additional info

Using the cart/add.js endpoint

What type of topic is this

Bug report

We’re currently running a sale and a ton of our customers are reporting that their cart keeps clearing itself. They almost certainly aren’t adding 500 items so I wonder if this limitation is a little bugged right now.

Hi Ceri, thanks for flagging this. Every cart that reaches the 500-line limit is expected to return an error and keep its existing contents. Since your cart is clearing instead, could you share the request ID from a cart/add.js request where this happened? That way I’ll be able to trace the request and identify other instances of the same behavior.

@ConduciveMammal, if your customers’ carts are clearing when they aren’t close to the 500-line limit, could you create a support ticket through the Shopify Help Center so we can investigate those cases separately?

@Paige-Shopify Sure!
a527366b-e25d-4113-b91b-78bcb1e5d027-1785830147

Before this request I had 450 lines in my cart

Just had this happen when the cart line count was at around ~480, it takes over 7 seconds to add a single line at this point.

Perfect, thanks so much for sharing that. I was able to trace the request and confirm that the cart cleared without returning an error or warning. I also found a few other instances of this behavior, particularly on stores using B2B. Thanks for flagging this. We’re looking into it now.

Happy to test this end when you’ve made changes, I’ve got a bulk-order solution and can get in 500 SKUs very easily.

Thanks! We’ve just rolled out a fix for this. Could you test it out and let us know if you’re seeing any issues?

@Paige-Shopify It falls over after about 490 SKUs, started getting 422 errors from the endpoint. See Request ID
930a73d4-be2e-4ba8-817d-6944b7d51240-1786009447

Thanks for checking, Ceri. Do you add 10 items at a time to the cart? We expect 422 responses at and over 500 lines since we have a hard platform limit at 500 lines.

Yes and no, it does it in batches of 50. But if that batch fails, it then does 1 by 1 to find the failure line.

Once I get to 490, it takes about 7 seconds to get a response on a single line, I get a 422 error and a generic “cart error” in the response message.

Just wanted to share an update that we’re investigating this on our end. I’ll get back to you once we’ve updated the existing solution.

Another update: We reviewed the request and confirmed that the 422 response was returned when the cart attempted to exceed the 500-line limit. Requests can take longer to process as a cart approaches that size, which is why it may have appeared that the error occurred at around 490 lines.

The generic cart error message isn’t expected though. The response should say Lines must be less than or equal to 500. We plan to correct the messaging, but we’re not able to prioritize that work at this time. I’ll update this thread once the fix has been deployed.

Great, thanks for your help!
I still don’t believe that the cap should be 500 if the server responds so slowly (7s response isn’t what I’d call an acceptable range) - but it’s much better than it was so thank you.