Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Relationship between cart.js API cart token & GraphQL cart ID

Relationship between cart.js API cart token & GraphQL cart ID

markflaunt
Visitor
1 0 1

Hi,

I'm looking for some advice / direction on using the Storefront API to amend line items in a customer's cart. 

https://shopify.dev/custom-storefronts/cart#retrieve-a-cart

What I'd like to understand better is how to retrieve a cart ID like the one referenced in the link for a pre-existing cart. I'm aware that once an item is added to a customer's cart, that there is then a cart token that can be retrieved from the cart.js API on the front end. Is it possible to use this cart token to retrieve the GraphQL cart ID mentioned in the link above?

For better context of the functionality we are trying to achieve, we want to be able to add an item to cart on the store front end with multiple custom properties, pass that item to our own API and use those properties to calculate a new line item price and finally amend the line item's price in the cart.

I've already spoken with Shopify Support and they pointed me in this direction, so any help or advice is greatly appreciated.

Replies 3 (3)

Jonny_Bloom
Shopify Partner
10 0 3

 I know this is an old thread, but if anyone can help with this it would be great also looking on how to get the cart.id with just access to a cart token.

_gogo
Shopify Partner
6 0 2

Hey Jonny, were you able to get an answer to this?

yodankful
Shopify Partner
19 0 12

i'm guessing still nothing? 😅