Bug with GraphQL Customer Query

Topic summary

A GraphQL query using orders_count:0 to retrieve customers without orders returns zero results, despite the admin filter showing the expected data exists.

Query behavior:

  • Returns empty nodes array with hasNextPage: true and null endCursor
  • Tested on API versions 2022-07 and 2022-10

Workaround identified:

  • Using customerSegmentMembers query with number_of_orders=0 returns expected results
  • However, this alternative has significantly more limited field availability compared to the standard customers query

Status: The issue remains unresolved. The user is requesting Shopify support to investigate why the orders_count:0 filter fails in the GraphQL customers query while working correctly in the admin interface.

Summarized with AI on November 23. AI used: claude-sonnet-4-5-20250929.

Hello @Shopify_77

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.

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