How can I resolve the cart token issue in my online store?

How can I resolve the cart token issue in my online store?

Website_ramsons
Visitor
1 0 1

Screenshot_16.png

We are facing with the cart token issue in which we are not getting a unique cart token everytime the end user tries to purchase any product and then redirecting to the checkout page. We are not getting a unique cart token on every purchase. So help us with a solution so that we can proceed our work on shopify online store.

Replies 2 (2)

DeepSingh
Shopify Partner
1 0 1

We are having the same issue. 

DeliveryDoc
Shopify Partner
1 0 0

Hello, 

 

We have noticed the same problem for one of our clients where we wanted to add a module to analyze cart additions. Typically, the cart token looks like this: "Z2NwLXVzLWVhc3QxOjAxSFpITjFXTjA0WjFOUzdKRkZQQzdQU1o2". With this token, it is possible to use the Storefront API to retrieve user information if they are logged in: example

 

https://mywebsite/api/2024-01/graphql.json

 

query {
cart(
id: "gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSFpITjFXTjA0WjFOUzdKRkZQQzdQU1o2"
) {
id
createdAt
updatedAt
buyerIdentity {
email
phone
customer {
id
}
countryCode
}
}
}
 
Response : 
 
{
"data": {
"cart": {
"id": "gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSFpITjFXTjA0WjFOUzdKRkZQQzdQU1o2?key=054caae2b5667a1a6d77228ca13e52c0",
"createdAt": "2024-06-04T12:54:44Z",
"updatedAt": "2024-06-04T12:54:44Z",
"buyerIdentity": {
"email": null,
"phone": null,
"customer": null,
"countryCode": "FR"
}
}
}
}
 
I don't understand why on the client the token not allow us to access cart data.
 
David,