Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello,
We are doing custom development where order of items in cart is very important for UX we are trying to achieve but we encountered unexpected behavior of cart api.
According to this changelog entry -> https://shopify.dev/changelog/cart-line-items-now-ordered-in-reverse-chronological-order-based-on-ti...cart items should behave by LIFO method.
In our tests we discovered that everything behaves correctly, until user visits checkout.
Once user has visited checkout, LIFO becomes FIFO on the site. So if user goes back to site without completing checkout, method for adding to card will behave by FIFO method.
We noticed that this will persist until user clears cookies / or clears cart with clear.js method and sometimes in random events of removing products from cart. After that it it becomes LIFO again.
I'm referencing similar thread here which seems to be unsolved https://community.shopify.com/c/hydrogen-headless-and-storefront/ajax-api-add-items-to-cart-order-of...
Can we get some help here to understand what and why this is happening?
Best,
Vedran
Anybody?
If the topic is in wrong section, please move it where it needs to be (moderators)
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025