Query which locations Shopify has taken the quantity for an open order or available quantities

11 0 3

I've been playing around with this for quite some time and have been unable to find a solution, any pointers or help on this would be greatly appreciated.

I'm trying to figure out how using the GraphQL API (or even REST) I can figure out which locations Shopify has used for the items on a given order.

I'm writing an app to push orders to a shipping provider via CSV, this is all working fine. The problem is working with different inventory locations.

When the order is created, Shopify will adjust the available stock levels accordingly by taking from the available locations in priority order. if I then use the API within my app to query to inventory levels for the items in the order at each location (querying the InventoryLevel field `available`), it returns the available quantities after Shopify has made the adjustments mentioned above. This makes it impossible to figure out what the actual available quantities are.

Additionally it seems like it's not possible to even find out which location Shopify used for a given item in an order which means I can't even calculate what the available quantities could be if the locations for the given order were changed.


All I'm really trying to do is replicate the behaviour that Shopify provides in the Orders admin inside an app. I feel like I must be missing something, has anyone else encountered a similar problem?