Hi,
We are using the Storefront GraphQL API to retrieve cart details by cart ID. However, we’re receiving null for the buyerIdentity field—even when the user is logged in to the storefront and has added or updated items in the cart. We expect the buyerIdentity to be populated in this scenario.
Hey @Dipesh_Patel - that does sound odd for sure, buyerIdentity should be populating if the buyer is logged in on the storefront. Would you be able to share an X-Request-ID from the API response headers you’re seeing attached to an API response from us where the buyerIdentity array is empty?
Happy to take a closer look into this for you - let me know if I can clarify anything on my end here
Hey @Alan_G , thanks for the quick response!
Yes, the issue occurs even when the customer is logged in. Here’s one of the ‘X-Request-ID’ values from a response where buyerIdentity is coming through as null
:
4f71cfc8-0cc6-4b37-9c2b-243909f04e86-1749192582
Let me know if you need additional details. Appreciate your help!
Thanks @Dipesh_Patel - I did a little digging on my end into the logs and can confirm it’s showing up as null when I replicate the query internally on my end too.
Out of curiosity, is your test shop using accelerated/dynamic checkout? It looks like it may be similar to this issue: Issue with buyerIdentity returning null
Let me know if deactivating accelerated checkout fixes this, or if you already have it deactivated/need to keep it activated and I can dig into this further for you - hope this helps a bit!
Hey @Alan_G , thanks for checking into this!
Please go ahead and dig further into the issue, as accelerated checkout can be both activated and deactivated depending on the context (theme or payment settings). It would be helpful to explore if something else might be affecting the behavior.
Let me know if you need any specific details from my side!
Thanks for confirming that @Dipesh_Patel - I think I get where you’re coming from. I’ll do some more investigation on my end here and loop back with you once I have more info. Speak soon!
Hey @Dipesh_Patel we did some further digging into this internally, and it looks like the cart doesn’t actually have a buyer identity attached to it
Could you confirm that the buyer is actually logged in (and if you’re using something like the cartCreate API, that you’re including the buyer identity information in the payload if the API call is coming from a client external to the storefront?).
If you’re clearing cookies on the storefront as well, that may leave buyers in a state where they appear to be logged in, but are not, so I’d double check that as well.
If the issue persists after checking all that, just let me know (if you can share a cart ID/request ID again in that case, that would be super helpful) Hope this helps a little bit at least!
hey @Alan_G thanks for the detailed insights!
I’ve verified everything you mentioned:
The buyer is indeed logged in.
We’re not using cartCreate API.
There’s no cookie clearing happening on our storefront that would affect login state.
However, the issue still persists.
Here are the relevant identifiers for further investigation:
x-request-id: 7db531dc-b8e5-4f5e-8797-ee627f41004b-1749639826
cartId: gid://shopify/Cart/Z2NwLWFzaWEtc291dGhlYXN0MTowMUpYRVZES1NaVllHOUpLRzA4R0JEUEZaWQ
Let me know if you need any more information from our side. Appreciate your help on this!
Thanks @Dipesh_Patel - appreciate you checking that. I’ll look into this further on our end here and loop back with you again once I have next steps. Really appreciate you confirming your set up there - speak again soon!
Hey @Dipesh_Patel - just following up here. I think we may have a solution. Can you try adding the
?key=
param to the end of the cart ID in your query? It would look like this for example:
{
cart(
id: "gid://shopify/Cart/Z2NwLXVzLWNlbnRyYWwxOjAxSlhKQTgxQTg4RFhFWE1KOEJLMjJFM1NE?key=2ddff5741e350becb3cf17cb464d6235"
)
This should allow you to pull the customer information. I’m not sure how you’re pulling the cart info, but it should generally be included in the payload info (just sharing here from Chrome Dev tools for my example above):
Hope this helps - let me know if I can clarify anything more on our end here
hey @Alan_G , thanks for the response!
That worked perfectly — I appreciate the help.
No worries @Dipesh_Patel - glad this worked! Let me know if we can help with anything else