GQL orders Closed query gets both true/false results

Solved
Highlighted
Tourist
12 0 3

Hey guys

I have a simple GQL query looking to get unfulfilled yet open orders (closed:false).  If I run this, even strip out the fulfillment status part, closed:true or closed:false is ignored and orders of both closed/not closed are returned.  Am I misunderstanding GQL that I should be able to do this?

query ($numProducts: Int!, $cursor: String) {
  orders(first: $numProducts, query: "fulfillment_status:unfulfilled closed:false", after: $cursor ) {
    edges {
      cursor
      node {
        closed
        id
        displayFulfillmentStatus
        updatedAt
        createdAt
        name
        shippingAddress {
          address1
          address2
          city
          provinceCode
        }
        
        customer {
          displayName
        }
      }
    }
    pageInfo {
      hasNextPage
    }
  }
}
0 Likes
Highlighted
Shopify Staff
Shopify Staff
493 98 88

This is an accepted solution.

Hey @dma550 

 

If you take a look at the query filter params closed is not listed here: https://shopify.dev/docs/admin-api/graphql/reference/queryroot?api[version]=2020-04

 

I would look into utilizing fulfillment_status along with status to achieve what you are looking for. 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


1 Like
Highlighted
Tourist
12 0 3

ahh so I was doing it wrong ;)  I thought the query could be any attribute through magic.

 

I checked that page and came up with this:

fulfillment_status:unfulfilled status:open

and I get all non closed unfulfilled orders.  I don't see where the status values are documented though, and I can't display the status in my output as its not a field.  Is "open" the right way to filter it for open statuses?

0 Likes
Highlighted
Tourist
12 0 3

ok, need to dig a little deeper but I found it.

 

status

Count orders of a given status.

(default: open)
  • open: Count open orders.
  • closed: Count closed orders.
  • any: Count orders of any status.
0 Likes