[Shopify] Widget to toggle display of instock/out of stock products

I’m wanting to display a toggle which allows the user to show out of stock products. It will be in stock products on load so I will pass a filter of ‘inventory_quantity > 0’ in the configure widget.

I then want to remove this filter on click of the toggle. I’ve tried the toggleRefinement widget (toggleRefinement | InstantSearch.js | Algolia) but it doesn’t seem to work alongside the the ‘inventory_quantity’ attribute.

Any advice is highly appreciated

If you are setting the filter via a configure widget, you won’t be able to modify it via a refinementList. You would either need to build a custom configuration widget using a connector (configure | InstantSearch.js | Algolia) or use a numeric slider for inventory to control it as a refinementList.