InventoryLevels for online fulfillable locations

rellinge
Tourist
3 0 4

Have a question about the Rest API. We have multiple locations, not all of which are online fulfillable.  I am trying to get the available inventory of a variant that is fulfillable online.
Right now the ProductVariant API returns inventory across all locations, not just those that are online fulfillable. The InventoryLevel API allows me to see the inventory by location, but I don't see an API I can query to tell me which locations are online fulfillable. Am I missing this?

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 227

Something like this is a snap using the GraphQL API. Here's a quick example below. When it comes to these scenarios, I use it rather than the REST API nine times out of ten.

{
  productVariants(first: 10) {
    edges {
      node {
        id
        title
        inventoryItem {
          inventoryLevels(first: 5) {
            edges {
              node {
                location {
                  id
                  name
                  fulfillsOnlineOrders
                }
              }
            }
          }
        }
      }
    }
  }
}
0 Likes
rellinge
Tourist
3 0 4

Shopify is telling us the per-variant/per-location inventory levels are not available with the Storefront API, only the Admin API, and we're trying to use this information in the Storefront.  How are you getting around this?  

0 Likes