location or location_id not available when receiving orders/paid webhook

aaonvja
New Member
2 0 0

When a customer pays for an order, I want to be able to send this information to a 3PL. This 3PL is dependent on which location Shopify applies to the order (usually based on stock levels).

So I did a webhook registration for orders/paid which is working great, my app receives the order details when I create an order. However the 'location_id' parameter is null. For example:

...

┃ cancelled_at: null,
┃ cancel_reason: null,
┃ total_price_usd: '13.68',
┃ checkout_token: 'xxx',
┃ reference: null,
┃ user_id: null,
┃ location_id: null,
┃ source_identifier: null,
┃ source_url: null,
┃ processed_at: '2021-02-02T13:27:27-05:00',
┃ device_id: null,
┃ phone: null,
┃ customer_locale: 'en',
┃ app_id: xxx,
┃ browser_ip: 'xxx',

...

If you can shed any light on how to get access to this location or location_id when a customer successfully completes payment for their order, this would be great.

A

0 Likes
Kevin_A
Shopify Staff
Shopify Staff
213 27 39

Hey @aaonvja 

I don't believe location_id is what you expect it to be. Please check out our order API docs for a more detailed explanation: https://shopify.dev/docs/admin-api/rest/reference/orders/order

Kevin_A | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

aaonvja
New Member
2 0 0

Thanks @Kevin_A, you were absolutely correct. I actually wanted to find where Shopify had allocated the order to be fulfilled from. I got there in the end, once the order had been placed I then needed to use the order_id to call the fulfillment_orders api. 

(/admin/api/2021-01/orders/{order_id}/fulfillment_orders.json)

0 Likes