Get CartID with GraphQL Storefront API 'null'

Get CartID with GraphQL Storefront API 'null'

lightdust
Shopify Partner
2 0 6

I'm trying to target the cart id with graphql, but I keep getting Data: { cart: null}. I'm doing the tests with the token it comes with in the json.

 

Screen Shot 2022-04-08 at 11.20.18 AM.png

 

Then I modify it with base64 <gid://shopify/Cart/"token">.  Is that the token that should be used or how could I extract the cartId with the frontstore API within a Shopify theme?

 

Screen Shot 2022-04-08 at 11.22.12 AM.png

  

Replies 5 (5)

chaffinated
Shopify Partner
2 0 3

I'm having the same issue following the same steps, so this is replicable. I even included credentials (i.e. cookies) with the Storefront API graphql request from the same domain origin, and same result. No error, just a null cart.

 

Did you find a workaround? I'll be looking into this more over the next couple of days and will reply if I find out anything else.

sushilsth21
Shopify Partner
11 0 5

Hey. Any solution you have got yet. I am also trying same but not working in my end as well.

 

MSuki93
Tourist
3 0 3

I'm also encountering this. Any solutions welcome!

chaffinated
Shopify Partner
2 0 3

@sushilsth21 @MSuki93  I contacted the support team a while back, and apparently the Storefront API and the standard cookie-based cart API are not interoperable. As it stands now, a cart created on one cannot be accessed by the other. Kind of a bummer, but maybe they'll add support in the future if it's requested enough.

sushilsth21
Shopify Partner
11 0 5

Hi @chaffinated  Is this same case for checkout as well? I tried using "checkoutDiscountCodeApplyV2" mutation and always endup getting "Checkout does not exist".