Checkbox filters
What you're building: a list of tickable values for one facet — pick any number of categories, brands or tags.
The default filter shape, and the right one whenever selecting two values should widen the result set rather than replace the first.
What you need
- Applies toA Div inside the browse wrapper
The group.
- Applies toThe group
Which facet to filter on.
- Applies toThe group
The control style.
- Applies toOne option inside the group
Cloned per facet value.
Build it
Design one option — a checkbox, a label, optionally a count — and mark it
filter-template. Inside it:
- — the value name
- — how many results have it
<div wf-algolia-element="filter-group" wf-algolia-field="category" wf-algolia-type="checkbox">
<label wf-algolia-element="filter-template">
<input type="checkbox" />
<span wf-algolia-element="filter-value-text"></span>
<span wf-algolia-element="filter-count"></span>
</label>
</div>
Combining selections
decides what two ticks mean:
or(default) — results matching eitherand— only results matching both
or suits categories, where people are widening. and suits tags, where each
tick should narrow.
and on a single-value field returns nothingIf a product has exactly one category, asking for results in both Shoes and
Hats returns an empty list — correctly, but confusingly. Use and only on fields
that hold several values per record.
Long lists
caps the visible values, with
and
labelling the toggle. Hidden values take
the class from data-hideclass.
Use so a ticked value near the bottom does not scroll out of view when results re-render.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| No options render | The facet is not declared in Algolia | Configuration → Facets |
| Ticking two returns nothing | match="and" on a single-value field | Use or |
| Selections jump around | Values re-sort by count on each render | wf-algolia-sort="selected-first" |
| Counts show but never change | The group is outside the browse wrapper | Move it inside |