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.

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

How to get cart token from StoreFront GraphQL API

How to get cart token from StoreFront GraphQL API

kushagrapushowl
Shopify Partner
9 1 4

I am building a custom Frontend for my store on top on StoreFront GraphQL API. For some purpose, I need the cart token whenever the cart is updated (i.e. lineitems are updated). 

When adding line items, I get back a checkout response which has an ID - a base64 string which is something like gid://shopify/Checkout/<someID>?key=<somekey>.

Is the cart token in that URL? Otherwise how can the cart token be obtained?

Reply 1 (1)

Gregarican
Shopify Partner
1033 86 294

Couldn't you listen for and handle the checkout creation webhook? That would pass along the cart token and everything else, right?