How to get unshipped orders excluding the cancelled orders in graphQL query?

Highlighted
New Member
2 0 0

I am trying to get unshipped orders excluding cancelled orders from the API using graplQL query. I see properties cancelledAt and cancelReason but both of them does not work for me when i use it in the query.

 

{
orders(first:10 query:"created_at:>=2020-02-20, email:'test@gmail.com' fulfillment_status:partial,unshipped, cancelledAt:null" sortKey:CREATED_AT ) {
edges {
cursor
node {
id
email
name
displayFulfillmentStatus
displayFinancialStatus
cancelledAt
cancelReason
createdAt
lineItems(first: 20) {
edges {
node {
fulfillableQuantity
}
}
}
tags
}
}
}
}

0 Likes
Highlighted
Shopify Staff
Shopify Staff
587 72 130

Hey @Menaka,

 

You can use an exclude in your query like -fulfillment_status:shipped, which will return all orders that do not have a fulfillment status of shipped. Putting a - before the field name is the same as using NOT like NOT fulfillment_status:shipped, either will work.

 

Another option is to use an OR instead of NOT, so you could have fulfillment_status:unshipped OR partial. Our API search syntax doc (link here) contains detailed information about all the operators available when querying the GraphQL API.

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

0 Likes