Get Location Id of the item on the order that shopify used, via the shopify order API

Highlighted
Shopify Partner
1 0 3

Hi,

I am using the Shopify REST API to retrieve order information (...admin/orders.json?).  A client has 2 locations that might stock inventory.  From the retrieve order API, how do I know which location the item was allocated from?  the "origin_location" field has a value that is the same for all orders, although the allocation was from different locations for different orders.  the "origin_location" id value is also not a location id value.  the "location_id" field has a value of "null". the "fulfillment_service":"manual" and "variant_inventory_management":"shopify" if that is important.

 

Thank You.

3 Likes
Highlighted
Shopify Staff
Shopify Staff
1129 82 173

Hey Donald, 

 

I wanted to touch on the 'location_id' on an order that you had mentioned, that location_id will only be populated when the order was placed through Shopify's Point of Sale system. On any other order that field will be null. 

 

For other orders that are placed, we'll temporarily take inventory from a location based on the shop's fulfillment priority settings. But those settings cannot be fetched with the API currently. Regardless of where we temporarily take the stock from though, you can still follow our guide here and create a fulfillment with any location that an item has been stocked at, and we will take inventory from that location instead. So ultimately, you can be the source of truth in this situation and you get to choose whichever location you want, provided that the item you're fulfilling has inventory there. 

0 Likes
Highlighted
Tourist
9 0 5

This would be helpful, or at least when you fulfill something let us know in the response if inventory was restocked somewhere else because the allocation location did not match the fulfillment location. What happens is when you fulfill from the correct location you end up adding stock back to the other location, which may allow overselling from the other location if you are not syncing that location as well and are only controlling inventory for the location you are fulfilling from.

2 Likes
Highlighted
Shopify Partner
4 0 7

Whilst the original question was answered there appears to be no solution at present.  Without knowing, by item where a piece was allocated from it does not seem possible to to make a decision about where to send the order item fulfilment to.

 

Our client has a main warehouse where all orders are sent for fulfilment and a store which is set up as a stock location from which they can fulfil orders.  Currently the warehouse has to refer all short picks to see if the store can handle them.  We would like to know when we read the order those items that Shopify has decided to fulfil from non warehouse locations in order that we do not bother the warehouse with them.  We could then re-direct the other part of the order to the chosen fulfilment location.

 

It seems like this functionality falls short of a usable solution, unless I am missing something.

 

Is it perhaps to do with the new fulfillment_order resource?

2 Likes
Highlighted
New Member
1 0 2

Hi

This seems to be a recurrent problem ... has this been addressed yet in the API ?

We are using the API to automate shipping for our customers and we need to determine the "pickup" address based on the selected location ...

 

2 Likes
Highlighted
New Member
1 0 0

We ended up using custom fulfillment locations.

You can add one here admin/settings/shipping/accounts_and_integrations

Then that will show up at your admin/settings/locations page so you can get the location id from there.

Make sure you put your inventory into those locations.

Then on the orders you will see by line item a field called fulfillment_service which will have the name of your location if inventory was pulled from your custom fulfillment location.

0 Likes
Highlighted
Tourist
5 0 2

Definitely a viable solution for some cases.

One issue I found with customer fulfillment locations is when using them for a product, you cannot have inventory/fulfill from any of your shops locations. For a product, one can only have Shopify locations OR customer fulfillment locations, not a mix. 

How the custom fulfillment location shows up in the JSON payload as the name of the customer fulfillment works. If there was a way to have the Shopify locations show up that way, we could find the Shopify location Id that is needed for creating fulfillments via API by matching the name with one of the Shopify locations names. 

Ideally tho, the Shopify location Id that is assigned to the unfulfilled order would be added to the json payload to remove the need to search by name. 

0 Likes
Highlighted
Shopify Expert
781 64 175

+1 on this question.

I couldn't find a way to get the location of a line item if the line item has stock at multiple locations.

What a bummer, that's good data... sucks letting clients down because of lack of data.

Shopify, I think the best solution would be to add a location_id property in line_items of the Order object.

Or if that's too hard, allow us to get Fulfillment priority via API (there's a hacky workaround you can do but it won't work because the Inventory Levels API does not return locations in their order of priority).

 

Founder of Speed Boostr (Shopify optimization and dev agency).
Creator of Theme Scientist (A/B testing app).
Creator of Order Automator (app that auto tags + fulfills orders, send emails).
Creator of Tip Jar (add a tip button to your store).
Creator of Shopify Analyzer (free performance analysis tool).
My team also builds custom apps and automated solutions.
Enjoy the adventure!
1 Like
Highlighted
New Member
4 0 0

The answer is GraphQL.  We have had to move over to GraphQL to tackle some of the newer areas of Shopify like order item stock allocations.  We have ended up with 80% GraphQL and 20% classic API solution.  It was a relatively hard transition but it has also helped with some call limit issues.

0 Likes
Highlighted
Shopify Expert
781 64 175

Thanks @tjbartram for the suggestion, do you have a link to the resource that allows you to get the location ID that Shopify assigns to the order line item? I looked around but couldn't find it.

Founder of Speed Boostr (Shopify optimization and dev agency).
Creator of Theme Scientist (A/B testing app).
Creator of Order Automator (app that auto tags + fulfills orders, send emails).
Creator of Tip Jar (add a tip button to your store).
Creator of Shopify Analyzer (free performance analysis tool).
My team also builds custom apps and automated solutions.
Enjoy the adventure!
0 Likes