Getting Orders based on location (reference_location_id)

Getting Orders based on location (reference_location_id)

garyrgilbert
Shopify Partner
431 41 181

 

If a shop has multiple fulfillment locations you can filter the orders (in the shop admin) based on a selected location. Unfortunately, it looks as though reference_location_id is not a filter option for the ORDER REST API.

 

By inspecting the post headers when I change the location I see a rather complex graphql query being sent to core "OrderListData" somewhere in there is an additional query ordersList() that returns the filtered results based on the order locationID.

 

Anyone out there know if its possible to do similar? I'm guessing it will be a rather expensive query but would be interested nevertheless.

 

Cheers

 

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Replies 3 (3)

sabross
Visitor
2 0 0

@garyrgilbert wrote:

 

If a shop has multiple fulfillment locations you can filter the orders (in the shop admin) based on a selected location. Unfortunately, it looks as though reference_location_id is not a filter option for the ORDER REST API.

 

By inspecting the post headers when I change the location I see a rather complex graphql query being sent to core "OrderListData" somewhere in there is an additional query ordersList() that returns the filtered results based on the order locationID.

 

Anyone out there know if its possible to do similar? I'm guessing it will be a rather expensive query but would be interested nevertheless.

 

Cheers

 



Could u use https://shopify.dev/docs/admin-api/graphql/reference/shipping-and-fulfillment/fulfillmentorder

garyrgilbert
Shopify Partner
431 41 181

Fulfillment order is specific to an order. 

It answers the question. "Which locations will fulfill the items on this order?"

The question I want answered is "Which orders have items that will be fulfilled from this location?"

or in other words:

"Give me the X number of orders that have items that can be fulfilled by Y location_id."

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
deepakrawat
Shopify Partner
11 0 0

Hello @garyrgilbert 

You had any luck with this query yet, we have a requirement where we have to fetch orders based on the assigned locations. Currently we are fetching individual orders which is taking up a lot of time.

Please let me know if there was any further development from Shopify's end or something insightful that you could suggest.

 

Thank you

Deepak

Software Developer @ TPSTECH.in