How can I get all orders by /admin/orders.json filter by fulfillment_status

Solved
Greg_Kujawa
Shopify Partner
1016 83 227

This is an accepted solution.

I stumbled upon something in terms of filtering a GraphQL orders query by fulfillment status. The query terms don't necessarily match up with the field values that are displayed when the data is returned back in the response.

So for example, if I were to query an orders that had a fulfillment status of unfulfilled, I'd need to do something like this:

 

{
  orders(first: 5, reverse:true, query: "fulfillment_status:unshipped") {
    edges {
      node {
        name
        id
        displayFulfillmentStatus
        displayFinancialStatus
      }
    }
  }
}

 

And if I were to query for any orders with a fulfillment status of fulfilled, I'd need to do this:

 

{
  orders(first: 5, reverse:true, query: "fulfillment_status:shipped") {
    edges {
      node {
        name
        id
        displayFulfillmentStatus
        displayFinancialStatus
      }
    }
  }
}

 

 And finally, for those partially fulfilled orders:

 

{
  orders(first: 5, reverse:true, query: "fulfillment_status:partial") {
    edges {
      node {
        name
        id
        displayFulfillmentStatus
        displayFinancialStatus
      }
    }
  }
}

 

It wouldn't be the worst idea if someone at Shopify expanded on the GraphQL API documentation so that the exact query terms would be spelled out!

theptrk
Tourist
9 1 2

Wow, @Greg_Kujawa  how did you find this? I've spent weeks on this issue. This is nowhere in the documentation.

0 Likes
Vinh
Tourist
8 0 2

If someone using the shopifyAPI python library for making paginated requests for orders and want both fulfilled, open and more, this is how to fetch the first page. You can then use the column fulfillment_status to differenciate fulfilled vs open.

shopify.Order.find(limit=250, created_at_min=created_at_min, status='any')

 

kpublik
New Member
2 1 0
I too thank you  @Greg_Kujawa.!!
 
It was really frustrating to get filtering working on fulfillment_status.  First, the API docs are not correct, as seen below in the "Order" reference.
 
Screen Shot 2021-04-16 at 02.14.01.png
 
 
 
And elsewhere in the documentation, the example from the GraphQL Learning Kit also uses the incorrect value.
 
Screen Shot 2021-04-16 at 02.36.58.png
 
 
 
The API documentation and examples need to be updated!
0 Likes