Out of stock availability filter does not work correctly with Storefront API

Out of stock availability filter does not work correctly with Storefront API

Kyl
Shopify Partner
8 0 2

When using storefront filtering through the Storefront API, the out of stock filter (below) does not work correctly. It returns both out of stock items and some items that have some variants in stock. This issue exists on multiple different themes I have developed and seems to have persisted on all previous versions of the API that I can currently test. All other filters work perfectly fine and I am performing no manipulation of the filters.

 

Specifically, the {available:false} input does not work correctly, whereas the {available:true} input (for In Stock) does work correctly.

 

Can anyone confirm if they have this functionality working or if they have replicated the issue?

 

 

{
  "id": "filter.v.availability.0",
  "label": "Out of stock",
  "count": 1,
  "input": "{\"available\":false}"
}

 

Reply 1 (1)

Kyl
Shopify Partner
8 0 2

Update: The issue appears to exist because the Availability filter looks at the availability of each variant in a product. If one variant is unavailable but others are available, the product will respond to the out of stock filter. This is a confusing user experience.

 

Since this filter is a Standard Shopify filter, one solution would be to add a configuration to the Availability filter so the merchant can decide whether the out of stock filter responds at the variant level or the product level.