Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Order Query response origin_location object

Order Query response origin_location object

johnztmkgl
Shopify Partner
2 0 1

Hello! 

 

We have been implementing integrations on various stores we have and ran into a little bit of an issue which is leaving me scratching my head.  In our stores we have three separate locations we will call them A, B, and C. When all is normal we have order data come back from the Admin API order query we generate and the location is A, B, or C as expected. Sometimes we have orders which come back with the Store Name.

 

We are mapping this location to which warehouse we are to fulfill the order from so this is causing some errors in order processing. 

 

In the example that occurred last night we have an order for 1 item. this item only has stock in warehouse/location A however the order came in with the Store Name as the origin_location.name field. 

 

Why is this occurring on most orders this data gets populated just fine, but on some it appears to just go with the Store Name and it is causing confusion and errors. 

 

thanks! 

Reply 1 (1)

garyrgilbert
Shopify Partner
431 41 186

Hi John,

 

I believe origin location is not a reliable method of determining where the shipment should be shipped from. As far as I understand the new fulfillment api's you should really be pulling the fulfillment_orders for a particular order.  The fulfillment order will have the location_id and the line_items that have been assigned to the fulfillment order to send.  This should be 99% accurate (there is one instance that I am aware of where it is not accurate but that's not the issue here).

 

so by doing a get from  /admin/api/2023-01/orders/[orderid]/fulfillment_orders.json will give you an array of all the fulfillment orders associated with the order as mentioned above.

 

You will probably be interested in the ones that are marked with the status "open".  

 

Cheers,

 

Gary

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