Re: How to fetch customer details who have ordered more than once

Solved

How to fetch customer details who have ordered more than once

gajenderdh947
Shopify Partner
13 0 1
Dear all i am trying to fetch my customer details based on number of orders  using following query Please help
 
{"query""query { customers(first: 5, query: {number_of_orders > 1}) { edges { node { id, firstName, lastName, email, phone, createdAt, updatedAt } } }}"}
 
This gives me following error 
{
    "errors": [
        {
            "message""syntax error, unexpected invalid token (\">\"), expecting COLON at [1, 54]",
            "locations": [
                {
                    "line"1,
                    "column"54
                }
            ]
        }
    ]
}
Accepted Solution (1)

SBD_
Shopify Staff
1831 273 418

This is an accepted solution.

Hey @gajenderdh947 

 

You'll need to format the query like this:

 

query {
  customers(first: 5, query: "orders_count:>10") {
    edges {
      node {
        id
        firstName
        lastName
        email
        phone
        createdAt
        updatedAt
      }
    }
  }
}

 

Scott | Developer Advocate @ Shopify 

View solution in original post

Replies 2 (2)

SBD_
Shopify Staff
1831 273 418

This is an accepted solution.

Hey @gajenderdh947 

 

You'll need to format the query like this:

 

query {
  customers(first: 5, query: "orders_count:>10") {
    edges {
      node {
        id
        firstName
        lastName
        email
        phone
        createdAt
        updatedAt
      }
    }
  }
}

 

Scott | Developer Advocate @ Shopify 

shakervalley
Shopify Partner
3 0 0

Hi, is this still the accepted solution? Copying the query above directly into GraphiQL returns the following errors array. Thanks!

 

"search": [
{
"path": [
"customers"
],
"query": "orders_count:>10",
"parsed": {
"field": "orders_count",
"range_gt": 10
},
"warnings": [
{
"field": "orders_count",
"message": "Invalid search field for this query."
}
]