You can use a panel
widget to access the results, and use the hidden
function to hide a refinement based on how many facet values it has:
instantsearch.widgets.panel({ hidden(options) { const facetValues = options.results.getFacetValues('brand'); return Array.isArray(facetValues) ? facetValues.length <= 1 : false; }, })(instantsearch.widgets.refinementList)({ container: '#brand-list', attribute: 'brand', })
Applies to InstantSearch v3 and later.