Hi community!
I am a new developer for shopify apps and I have a couple of questions regarding the Customer API when querying through GraphQL:
-
When I query customers, the total amount spent and order count fields return 0, even though I submitted a test order via the store. Does anyone know what is happening?
-
I’d also like to track whether a customer has an abandoned cart. Could anyone advise on the best way to extract this information using GraphQL?
I hope someone can guide me to the right way of using the graphql
Reference image of my customer graphql
Hi @Kevin_Cheng
It’s possible you’re seeing 0 being returned because the orders are test orders - but I’m investigating if that is a limitation or not.
RE: abandoned carts: Shopify doesn’t directly expose “abandoned cart” as a field on the customer object. However, you can infer this by looking for customers with a recent abandoned checkout. In the API, this is tracked by the last_abandoned_order_date field on customers.
Thank you for clarifying. Just to check is there any plan for Shopify to eventually include order count and total amount spent for customers even when the orders are test orders?
Hi Liam, I have one more question. Could you share with me an example of how do we track the last abandoned order date of a customer?
I can’t seem to find the appropriate documentation for this
Okay managed to get the abandoned cart from
query GetAbandonedCheckouts($first: Int!) {abandonedCheckouts(first: $first)