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.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

GraphQL Query Orders not returning all orders on some queries

GraphQL Query Orders not returning all orders on some queries

Mad_Wizard
Shopify Partner
38 5 7

I've got an issue where I can query and get all the orders. But on some query parameters, the counts drop inexplicably.  Here's my simple base graphql query:

 

 

query getOrders($myquery: String!) {
      orders(first:250, query: $myquery) {
        edges {
            node {
                id
                createdAt
                displayFinancialStatus
                cancelledAt
            }
        }
      }
    }

 

 

 

 

Now here are some various query parameters I pass in and the records returned (bolded make no sense to me)

 

"query" : "created_at:>'2022-05-01T23:39:20Z'"  : returns 250

"query" : "created_at:>'2022-05-01T23:39:20Z' and created_at:<'2024-10-25T23:39:20Z'"  :  returns 10

"query" : "created_at:>'2022-05-01T23:39:20Z' and -financial_status:refunded" : returns 10

"query" : "-financial_status:refunded" : returns 250

"query" : "-financial_status:refunded and -status:cancelled" : returns 10

 

The bolded make no sense.  I checked orders that would show vs those that don't and couldn't find a difference.  And I tried this on two different stores and same effect (differing counts) which makes no sense.  Is the "and" not correct or something?   

 

If you found my post helpful, please like and accept it.

Don "The Mad Wizard" Cole
Your Store Wizards
www.yourstorewizards.com
Over 20 years in eCommerce development.

Contact us at support@yourstorewizards.com if you'd like U.S. based professional help.
Reply 1 (1)

Eric-HAN
Shopify Partner
297 30 32

Hi, Mad

 

and should be uppercase  in query  ,otherwise it will not works  .

pls try '"query" : "created_at:>'2022-05-01T23:39:20Z' AND created_at:<'2024-10-25T23:39:20Z'" 

- Helpful? Please hit Like and mark it as a solution
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me    Buy Me A Coffee