I’m using GraphQL to move our Shopify Store to custom jam-stack. I’ve created functionality to create a cart and retrieve the cart via it’s ID, and now I’m trying to update the cart for every new product added/modified.
The documentation behind the cartLinesUpdate or cartLinesAdd require use of the CartLine Object for passing data like product ID, quantity, etc. and the demo is understandable enough…
I’ve tried passing every ID imaginable to this mutation and it always returns invalid ID. Turns out the Variant IDs my app is getting are like twice as long as what the existing liquid theme are retreiving.
I seem to not have a clear idea of what data to pass to the CartLines Object for my mutation to be happy.
The id you are probably looking for when using GraphQL is the resource legacyResourceId. That field will return the resource id field when using the REST API.
However, from this thread, it doesn’t seem to be available on LineItems. I have not verified this though. Not sure if you need it for your use case but something to look out for.
Bumping this since I’m also running to the same issue. It’s strange because cartLinesAdd works with the same merchandiseId’s so I’m not sure what’s going on with cartLinesRemove