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.
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
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.
I am currently in the same boat. I used to think location_id on the order was the location from which the order would be fulfilled.
Now I am looking at fulfillment_orders as you mentioned. But I am a bit confused as to when I get these.
So for example I am doing currently immediately after the order is created but the fulfillment_orders are empty. Do I have to wait for the fulfillment to be created? Any webhook to listen to / wait for?
Thanks so much in advance