How to determine which store locations are online and how to get only online inventory

Kris_Doyle
Shopify Partner
140 1 42

I think when you first create your shop, you automatically get an Online location, which is pretty easy to identify since it's literally called "Online Location". But since the name can be changed, this isn't reliable to determine that this location can fulfill online orders, or that it should be included in "online" inventory. I'm looking for another way to tell that a location is "online" so I can consider the inventory at that location available for online fulfilment. Unfortunately the Locations API doesn't have an online flag for each location.

 

So my questions are:

 

1. Using the API (REST or GraphQL, doesn't matter which) how can I get only the online inventory for a given product or variant?

 

2. How can I reliably know that a given location can fulfil online orders?

 

Hopefully these questions makes sense 😁

Replies 2 (2)

Liam
Shopify Staff
2731 302 783

Hi Kris,

 

So you can use the InventoryLevel API endpoint to get a a list of inventory levels (here's a example of what this would look like) and there are parameters for `inventory_item_ids` and `location_ids` - which should help get the info you're looking for. It's also worth checking the Location resource and the InventoryItem resource too.

 

Hope this helps,

Liam | Developer Advocate @ 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

Kris_Doyle
Shopify Partner
140 1 42

Hi @Liam ,

 

Thanks for the assistance with this. I'm ok with the Locations API and the InventoryItem resource, etc. It's not a problem to get the inventory info, it's that I can't see a way to know which store locations are online.

 

For example, when I go to the Locations section in my settings, I see this:

Kris_Doyle_0-1689253232765.png

Is there a way via the Locations API to get that "Fulfill online order from this location" flag? If I could tell that it was an "online" location, then I can just get the inventory for the online locations and I'd be done. It's that I can't tell if it's an "online" location or not.

 

Thanks! 🙂