Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Many fields don't exist on type 'Customer' - GraphQL API

Andy_ACN
Shopify Partner
2 0 0

Hi everyone,

I haven't made any code changes recently, but when I run the following query now, Shopify response many errors, which didn't happen before. For Example,

message "

Field 'ordersCount' doesn't exist on type 'Customer" but in the API document there is a

orders Count field for the Customer object.

 

I cant figure out why this is happened, please tell me where the problem is.

Thank you for your support!    

 

Request Body ==== 
{
"query": "query { customer(id: \"gid://shopify/Customer/6868074889508\") { firstName hasNote hasTimelineComment id lastName legacyResourceId note ordersCount phone state tags taxExempt totalSpent totalSpentV2 {amount } } }"
}
Response Body ==== 
{
"errors": [
{
"message": "Field 'ordersCount' doesn't exist on type 'Customer'",
"locations": [
{
"line": 1,
"column": 115
}
],
"path": [
"query",
"customer",
"ordersCount"
],
"extensions": {
"code": "undefinedField",
"typeName": "Customer",
"fieldName": "ordersCount"
}
},
{

"message": "Field 'hasNote' doesn't exist on type 'Customer'",
"locations": [
{
"line": 1,
"column": 127
}
],
"path": [
"query",
"customer",
"hasNote"
],
"extensions": {
"code": "undefinedField",
"typeName": "Customer",
"fieldName": "hasNote"
}
}
]
}

 

Reply 1 (1)

garyrgilbert
Shopify Partner
385 40 155

HI Andy,

 

its not ordersCount its numberOfOrders, its also not hasNote but just note

 

See the object definition: https://shopify.dev/docs/api/admin-graphql/2023-04/objects/customer

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution