Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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

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

Andy_ACN
Shopify Partner
2 0 1

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
432 41 190

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