Re:

Solved

origin_location DEPRECATION

lthomas1
Shopify Partner
30 0 5

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
1453 238 512

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 7 (7)

EcomGraduates
Shopify Partner
735 63 105

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
        }
      ]
    }
  ]
}

 


If this fixed your issue, likes and accepting as a solution are highly appreciated.

Build an online presence with our custom built Shopify Theme EcomifyTheme




lthomas1
Shopify Partner
30 0 5

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
1453 238 512

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

menelaos_vergis
Shopify Partner
35 0 6

This seems to be a bug at the Shopify Rest API.

Location Id is no longer populated in POS purchases

Build Shopify Applications with the most simple UX possible
ShopifyDevSup
Shopify Staff
1453 238 512

Hey @menelaos_vergis

 

Can you reach out to our support teams to share the details of the bug you're noticing. With examples of POS orders and any API calls you are making, they will be able to look in to that closer with you. 

 

Hope that helps. 

 

- Kyle G. 

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

lars_old_man
Shopify Partner
1 0 1

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?