Bug with GraphQL Customer Query

garyrgilbert
Shopify Partner
397 40 166

Hello @Shopify 

 

I'm having a bit of an issue with the customers root query returning a different result than the filter in the admin.

 

This query should return customers without any orders.

 

 

 query getCustomers($limit:Int!,$after:String){
            customers(first:$limit after:$after query:"orders_count:0"){
              pageInfo{
                hasNextPage
                endCursor
              }
              nodes{
                id
                defaultAddress{
                    address1
                    zip
                }
              }
            }
          }

 

 

However I get zero results returned:

{
  "data": {
    "customers": {
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": null
      },
      "nodes": []
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 42,
      "actualQueryCost": 3,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 997,
        "restoreRate": 50
      }
    }
  }
}

The "Same" query run in the admin however, returns.

 

garyrgilbert_0-1675085236016.png

 

This query which I pulled out of the admin:

{  
  customerSegmentMembers(
    first:20 query:"number_of_orders=0"
  ) {
    pageInfo {
      hasNextPage
      hasPreviousPage
    }
    edges {
      node{
        id
        defaultAddress {
          id         
        }
      }
    }
  }
}

Returns the expected results, however has a much more limited number of fields that can be returned.

 

Can you please have a look at this?

 

Tested with versions 2022-07 & 10 and 2023-01

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