Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi everyone,
With the deprecation of the Checkout API, I’m transitioning to Shopify’s Cart API. In the Checkout API, we had a simple way to replace the entire cart by passing new line items, but I don’t see a direct equivalent in the Cart API.
From my research, the Cart API provides mutations like:
However, there doesn’t seem to be a cartLinesReplace or cartReplace mutation. This means that if I want to completely replace the cart with a new set of line items, I need to:
Is there an efficient way to replace the entire cart in a single API call?
I have the exact same question. In the migration guide it says
The cartLinesUpdate mutation behaves similarly to checkoutLineItemsReplace in the Checkout API. It replaces the existing line items in the cart with the new line items provided in the lines argument. This is useful when you want to completely refresh the cart contents.
But I did not find this to be true. It needs me to pass the cart line id, which does not make sense if my new cart has more or less items than the old cart. The guide also shows a `ProductVariant` ID, but I'm pretty sure that's a mistake and it should be a CartLine ID.
Shopify and our financial partners regularly review and update verification requiremen...
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