CART API - > LIFO becomes FIFO when user goes into checkout pages

CART API - > LIFO becomes FIFO when user goes into checkout pages

VedranD
Shopify Partner
7 0 0

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

Reply 1 (1)

VedranD
Shopify Partner
7 0 0

Anybody? 

If the topic is in wrong section, please move it where it needs to be (moderators)