FROM CACHE - en_header

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

markflaunt
New Member
1 0 0

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.

Reply 1 (1)
Jonny_Bloom
Tourist
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.