Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
we have an app that use store front api to add/remove product to cart and recently noticed that there are 2 different format of cart id
Format 1: gid://shopify/Cart/Z2NwLXVzLWNlbnRyYWwxOjAxSDFWUkpFN05aWU1BWjJEMDJRU1dISzc5
Format 2: gid://shopify/Cart/c1-cbdb4c4178dafdb65ad2fb30c5cd5d63
and cart with Format 1 id caused some problems. while getting cart or add line items to it.
when calling cartLinesAdd, it returns error De opgegeven winkelwagen bestaat niet. (the cart does not exist.)
but meanwhile it looks like it created a new cart and added the item to it.
but when I call api to retrieve the same cart, it returns the result, but it has total amount (probably added before this become an issue ?) with no line items
can someone please explain what is going on here ? what's the deal with those 2 format of ids, and possible solution for it. like how to make sure when a new cart is created, it will be the format 2 id ?
we are using 2022-10 api version, which is not deprecated yet.
i had the same issue but for me I'm not even able to query cart with the cart in format 1. If i try to query the cart with that id i get the following result
I'm using api/2023-10
{
"data": {
"cart": null
},
"extensions": {
"context": {
"country": "LT",
"language": "NL"
}
}
}