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.

Re: Location_id not shown in API respond

Location_id not shown in API respond

Tomcheng
Shopify Partner
5 0 0

Here is my request data:

 

curl  -X GET https://quickstart-8dd91d84.myshopify.com/admin/api/2023-10/orders.json?status=open -H 'Content-Type: application/json' -H 'X-Shopify-Access-Token:xxxxxxxxxxxxxxxxxxxxxxxxxxx'

In respond data,

order 1001, origin from location B, no loaction_id data, changed to location A, still no loaction_id data.

order 1002, origin form location A(default loaction), had loaction_id data.

order 1004, origin form location A(default loaction), no loaction_id data.

 

I don't know how can I make the location_id can be always shown.

 

"location_id"null,
"merchant_of_record_app_id"null,
"name""#1001",
 

"location_id": 92291629329,

"merchant_of_record_app_id": null,

"name": "#1002",

 

"location_id"null,
"merchant_of_record_app_id"null,
"name""#1004",
Replies 10 (10)

SBD_
Shopify Staff
1831 273 421
Tomcheng
Shopify Partner
5 0 0

Hi @SBD_ Thanks for your answer, but I need to use the Location_id to identify open orders,  because I have some warehouses, each warehouse has different orders, how can the warehouses read the oders of themself. for now, the warehouses can read all these orders, but they can't identify their orders without Location_id. How can I help them?

SBD_
Shopify Staff
1831 273 421

Thanks for the info!

From the docs: Location_id is the ID of one of the locations that was assigned to fulfill the order when the order was created. Orders can have multiple fulfillment orders. These fulfillment orders can each be assigned to a different location which is responsible for fulfilling a subset of the items in an order. The Order.location_id field will only point to one of these locations. Use the FulfillmentOrder resource for up-to-date fulfillment location information.

 

If you're open to using GraphQL, you can filter fulfillment orders by location ID. I can't see an equivalent in REST. Let me know if you get stuck!

Scott | Developer Advocate @ Shopify 

Tomcheng
Shopify Partner
5 0 0

Hi Scott, I try to study this GraphQL, and make a request like below:

{
  fulfillmentOrders(first: 3){
    edges {
      node {
        assignedLocation{
          location{
            id
          }
        }
        createdAt
        orderName
        orderId
        destination{
            address1
            address2
            city
            countryCode
            email
            firstName
            lastName
            phone
            province
            zip
        }
      }
    }
  }
}

I tried to use filter some filed by location ID, but all were failed, which filed should I choose? And also I can't choose the proudct infomation, how can I get it? @SBD_ 

Tomcheng
Shopify Partner
5 0 0

I found how to use the filter like below:

 

{fulfillmentOrders (first: 8, query: "assigned_location_id:'93810262289'"){
edges {
node {
orderName
orderId
createdAt
destination{
address1
address2
city
countryCode
email
firstName
lastName
phone
province
zip
}
assignedLocation{
countryCode
location{
id
}
}
lineItems(first:10){
edges{
node{
productTitle
sku
totalQuantity
}
}
}
}
}
}

and also got the product infomation, but I still have a problem, I can't filter the orders by date time, for example, I want choose all today's orders, how can do it?

SBD_
Shopify Staff
1831 273 421

Hey @Tomcheng 

 

Sorry to report it appears the only supported query parameters are `assigned_location_id` and `status`.

Scott | Developer Advocate @ Shopify 

Adit_Forstok
Shopify Partner
2 0 1

Hi @SBD_ 

 

We have same issue location_id not found form API response. the location_id always empty when new order status even though it has appeared in the shopify seller center. 

 

Please help from Support Ticket 45858111order shopify.png

lumberbeard
Visitor
2 0 1

Just replying to say we all have the exact same problem we're trying to solve.  The fact that the assigned fulfill location doesn't just show from the orders api is pretty ridiculous. This should be there by default without trying to band-aid multiple api calls or a shopify flow creating tags to achieve so we can reference this downstream in other applications like Netsuite.

Adit_Forstok
Shopify Partner
2 0 1

Hi @SBD_ 

 

We found scenario location_id from endpoint GET /admin/api/2024-01/orders/450789469.json? 

1.  Customer detail null, location_id show at response 

customer null.png

2. Customer detail available, location_id null customerdetail available.png

 

Did you have exact problem with API GET Order @lumberbeard  ?? 

 

Please help assistant to fixing this issue @SBD_ 

SBD_
Shopify Staff
1831 273 421

Hey @Adit_Forstok 

 

Please reach out to Partner Support with your store information and these two example orders.

Scott | Developer Advocate @ Shopify