How to get Location using Shopify API

If there are multiple items in an order and each item’s location is different, which Shopify API can be used to retrieve this information?

I found that using “/admin/api/2024-10/orders/{order_id}/fulfillments.json” can retrieve the LocationID of the order, but this can only be created after the fulfillment is created, so I couldn’t retrieve it.

The timing I want to retrieve it is immediately after the order is placed. In the order management screen, the items linked to each location are displayed before the fulfillment is created, so I want to retrieve the values displayed there.

Also, perhaps because it is an online order, the Location_id in “/admin/api/2024-10/orders.json” returns null for all orders.

From what I can tell with the orders API you can get the lineItems → variant → inventoryItem → inventoryLevel → id if you want to grab just the location ID.

I am unsure if that is sufficient for what you want though…

You may try asking the .dev Assistant to help write code to fetch that data for you.