Available_inventory not taking into account Locations

We’ve got many locations configured for our Shopify store, each with it’s own stock levels. Only one of these locations is configured to “Fulfill online orders from this location”.

The products rendered via instantsearch have a data object associated with them that contains the “available_inventory” datapoint, among others.

Some of our products have inventory in a number of secondary locations, but 0 inventory in the only location that’s configured to fulfill orders. These products are rightly unavailable on our store front.

In this case, shouldn’t the “available_inventory” datapoint be equal to “false”?

Why would/should available_inventory get converted from a number to a boolean when there is no stock? available_inventory should return 0. You then check inventory with

Looking at some Shopify data, I don’t actually see available_inventory. I see inventory_available though. In more than one case though I see inventory_quantity = 0 but inventory_available = true because these products have “Continue selling when out of stock” set to true.

@the

I misspoke. I’m only speaking about inventory_available. If a product has stock in ANY location it will have a value of true, despite that product having 0 inventory in the only location thats configured to fulfill inventory. This is the case regardless of whether or not the product is configured to continue selling when out of stock.

Ah yes, I see.

From Algolia’s docs

The inventory_available attribute is true for records when their inventory_quantity is greater than 0, or if they have the Continue selling when out of stock setting enabled.

There are three different settings for handling out of stock items, but interesting there is no mention (that I could find) of how Algolia handles multiple locations.

Perhaps there is a piece of the puzzle missing.

Hi @cferg and @the ,

We do not support multi location inventory completely as of now, but I’m passing this feedback to the dedicated team on your behalf.

Shopify’s API generates inventory_quantity and when it does this it includes all locations within the inventory_quantity attribute. This means that it is not possible for us to discern which items in inventory_quantity are available items from a location fulfilling orders and which are not.

If you have your inventory data outside of Shopify (for example if you are utilising an external inventory management software), then one solution would be to put that data within metafields - which our integration can then pick up and could be used to add a filter.

Hope this helps!

1 Like