How to get Order Item Location through Order API

Ram_Kumar
Tourist
16 0 2

Hello,

 

How can i get the Order inventory item location to be allocated for the order.

 

I have 2 location in my store. 

 

1) NPF Warehouse

2) Kamarajar Salai

 

My below order is allocated in Kamarajar Salai Location.

 

shop.PNG

 

Test003 Product in both my warehouses.

shop3.PNG

 

How can i get this Location in Order API. So that i can send the order to that particular allocated location to fulfill order.

 

When i try to get inventory location using below API, Item shown in both my locations.

/admin/api/2019-10/locations/26812946/inventory_levels.json

This will ship my order in both my locations. 

 

shop.PNG

 

I need Order Allocated item location, what is the usage of showing Location Name in the Front end. I hope this is a bug in shopify API.

 

Please reply asap or give any solution to fix. 

 

Thanks

 

 

0 Likes
Ram_Kumar
Tourist
16 0 2

Hi Team,

 

Please check my request, Is any way to help you get this ?

 

Can we get Order Item Allocated location before Fulfillment of an order ?  same like you shown in Shopify UI ?

 

Thanks for your help

0 Likes
hassain
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 134

Hi @Ram_Kumar ,

 

The Orders resource of the REST Admin API does not keep a reference to the location the order will be fulfilled from (e.g. Kamarajar Salai). The "locations_id" field on the Orders resource is meant to track the physical location in which the order was purchased from. Due to this, this field is only populated when the order is purchased via Shopify POS - for all online store orders this field will be `null`.

 

In order to get the location this order will be fulfilled from via the API, you need to use the FulfillmentOrder resource: https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillmentorder#index-20... . The FulfillmentOrder resource represents either an item or a group of items in an order that are to be fulfilled from the same location. There can be more than one fulfillment order for an order at a given location. Within the FulfillmentOrder resource, the "assigned_location_id"  and the "assigned_location" fields should give you the information you are looking for.

 

Here is the sample API request to get all of the FulfillmentOrders associated with an order on your store: GET https://{store-name}.myshopify.com/admin/api/2020-01/orders/{order-id}/fulfillment_orders.json. To access this data, your app may need the following access scopes: read_assigned_fulfillment_orders, read_merchant_managed_fulfillment_orders, read_third_party_fulfillment_orders (https://shopify.dev/tutorials/manage-fulfillments-with-fulfillment-and-fulfillmentorder-resources)

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Mark_
Tourist
4 0 2

I've setup a development store with 2 locations where I'm making test orders. Looking at the orders in admin I can see it is assigning locations to orders depending on where the inventory is located. I'm using the GraphQL API BTW. Orders that haven't been fulfilled have draftFulfillments but draftFulfillments doesn't have a location field. When I mark the order as fulfilled the order has fulfillments which has a location field. How do I get the location of an order before it has been marked fulfilled? Orders never seem to have fulfillmentOrders. What's the difference between fulfillments and fulfilment orders?

0 Likes
Mark_
Tourist
4 0 2

Following on from my previous post above - the reason fulfillmentOrders wasn't showing up for me was because "Merchant managed fulfillment orders" permission wasn't set.  So you can now get the assigned location in fulfillmentOrders before the order is fulfilled.

gorodezkiy
Shopify Expert
5 0 7

Following on from my previous post above - the reason fulfillmentOrders wasn't showing up for me was because "Merchant managed fulfillment orders" permission wasn't set

Wow, that was surprising! Thank you for the advice @Mark_ 

First I thought that the `read_assigned_fulfillment_orders` permission should be enough, but the response stayed empty until `read_merchant_managed_fulfillment_orders` was not set 

0 Likes