origin_location DEPRECATION

Solved
lthomas1
Shopify Partner
23 0 2

Hello,

I am using the origin location (order/line_items/origin_location) field to get the name of the pos location from where the order was placed. 
Now that the field is getting deprecated, can anyone help me from where I can get the same (pos location name from where the order was placed) ?

I tried fulfillment orders and several other API's but not getting the location name or id.

 

Thanks,
Lily

Accepted Solution (1)
ShopifyDevSup
Shopify Staff
Shopify Staff
1202 190 419

This is an accepted solution.

Hi lthomas1,

 

The closest available now is Order.location_id and then you can [query the location] to get the name of it. POS locations need to be defined in the admin under Settings > Locations in order to be available for the POS app to sign in to, and the location data can still be queried for the name and other info if the location is disabled.

 

Hope you have a great day.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 5 (5)
EcomGraduates
Shopify Partner
588 48 73

If the order/line_items/origin_location field is being deprecated and you need to find the name of the POS location from where the order was placed, you may be able to use the fulfillments endpoint in the Shopify API to retrieve this information.

When an order is fulfilled, Shopify creates a fulfillment object that contains information about the fulfillment, including the location where it was fulfilled. You can use the fulfillments endpoint to retrieve a list of all fulfillments associated with an order, and then inspect the location_id property of each fulfillment object to determine the location where the fulfillment occurred.

Here's an example of how to retrieve a list of fulfillments for an order and inspect the location_id property:

 

example: 

{
  "fulfillments": [
    {
      "id": 123456789,
      "order_id": 987654321,
      "location_id": 555555,
      "created_at": "2023-03-01T12:34:56-05:00",
      "line_items": [
        {
          "id": 111111,
          "fulfillment_service": "manual",
          "fulfillment_status": "fulfilled",
          "quantity": 1
        }
      ]
    },
    {
      "id": 987654321,
      "order_id": 123456789,
      "location_id": 444444,
      "created_at": "2023-03-02T12:34:56-05:00",
      "line_items": [
        {
          "id": 222222,
          "fulfillment_service": "manual",
          "fulfillment_status": "fulfilled",
          "quantity": 2
        }
      ]
    }
  ]
}

 

banned
lthomas1
Shopify Partner
23 0 2

Hello,

In the case an order is fulfilled, it will work. 
But if it's a pos order and not fulfilled, is there a way to get the origin location ?

 

Thanks,
Lily

ShopifyDevSup
Shopify Staff
Shopify Staff
1202 190 419

This is an accepted solution.

Hi lthomas1,

 

The closest available now is Order.location_id and then you can [query the location] to get the name of it. POS locations need to be defined in the admin under Settings > Locations in order to be available for the POS app to sign in to, and the location data can still be queried for the name and other info if the location is disabled.

 

Hope you have a great day.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

chirag_su
Shopify Partner
1 0 0

Hi Team,

 

The header level 'location_id' reads null on the Order object. 

"location_id": null

 

I see the Location has been setup in settings with all information populated. 

What could be the issue? 

 

Thanks,

CS

lars_old_man
Shopify Partner
1 0 0

Hi, the origin_location_ID will help you to retrieve the location if the line items are from one location. But what if one order has multiple fulfillment locations? I dont believe that shopify has a data point for line item in one order if they are fullfilled in different locations. Or am i wrong?