Faceted search helps shoppers move from a broad product query to a useful shortlist. Instead of forcing a customer to refine a search term repeatedly, it lets them combine attributes such as brand, size, color, price, and availability. In a WooCommerce store, well-designed facets can reduce product-listing friction while giving agencies a flexible search experience that is independent of the underlying WordPress catalog structure.
What a facet is in Algolia
A facet is a filterable product attribute that Algolia can return with matching value counts. For example, a search for running shoes might return facet values for Brand, Size, Color, and Gender. The shopper can then select one or more values without changing the original query.
To use an attribute as a facet, add it to Algolia’s attributesForFaceting index setting. A product record might contain data like this:
{
"objectID": "wc_4821",
"name": "Trail Runner Pro",
"brand": "Northstar",
"categories": ["Shoes", "Running"],
"color": ["Black", "Orange"],
"sizes": ["8", "9", "10", "11"],
"stock_status": "instock",
"price": 129.99
}
An index configuration could expose the relevant fields as facets:
"attributesForFaceting": [
"searchable(brand)",
"categories",
"color",
"sizes",
"stock_status",
"price_range"
]
Use searchable(...) for facets where users should be able to search within a long list of values, such as brands, manufacturers, or store locations. Do not mark every attribute as searchable by default; doing so can add unnecessary interface complexity and indexing overhead.
Choose facet attributes deliberately
WooCommerce data often contains several representations of the same concept. A product may have a global attribute, a variation attribute, a custom field, and a taxonomy term that all appear to describe color. Before configuring Algolia, decide which normalized field should drive filtering.
- Use stable identifiers where possible. A brand slug or term ID avoids problems caused by renamed labels and inconsistent capitalization.
- Keep display labels separate from filter values. The interface can display “In stock” while the indexed value remains
instock. - Flatten values that shoppers need to filter. If a product has multiple colors or sizes, index them as arrays so a single record can match each applicable value.
- Avoid low-value facets. Internal IDs, editorial metadata, and attributes with hundreds of nearly unique values rarely help shoppers narrow results.
For multilingual catalogs, decide whether facet values should be translated during indexing or represented with localized indices. Mixing translated and untranslated values in one facet can create duplicate-looking options and confusing counts.
Build filters from user selections
When a shopper selects multiple values, the filter logic needs to match the expected behavior. Algolia’s facetFilters format uses nested arrays to represent AND and OR logic. Values in the same inner array are alternatives; separate inner arrays must all match.
const filters = [
["brand:Northstar", "brand:Peakline"],
["color:Black"],
["stock_status:instock"]
];
const response = await searchClient
.initIndex("products")
.search("running shoes", {
facetFilters: filters,
facets: ["brand", "color", "stock_status"]
});
This query means Northstar or Peakline, and Black, and in stock. That distinction matters in the UI: selecting two brands should normally broaden the brand condition, while selecting a brand and a color should narrow the result set.
For price and other numeric values, use numericFilters or the filters parameter rather than encoding arbitrary numeric ranges as text facets. For example:
const response = await searchClient
.initIndex("products")
.search("desk", {
numericFilters: [
"price >= 100",
"price <= 500"
],
facetFilters: ["stock_status:instock"]
});
Algolia also supports a unified filters expression for facet, numeric, and tag-style conditions. Choose one filtering approach per implementation pattern and centralize the query builder so URL state, server-rendered results, and client-side refinement all use the same rules.
Return facet counts with the search response
Request only the facets needed by the current catalog page. The response includes counts that can be rendered beside each option:
const response = await index.search(query, {
facets: ["brand", "categories", "color", "sizes"],
facetFilters: activeFacetFilters
});
const brands = response.facets?.brand || {};
Facet counts are calculated in the context of the current query and active filters. This is useful because a shopper can immediately see which options still produce results. In many interfaces, the currently selected value should remain visible even if its count changes, so do not remove selected options solely because the returned count is zero.
For a large list of brands or categories, use Algolia’s facet search capability to let the shopper search within facet values. This is preferable to rendering hundreds of checkboxes and helps keep the WooCommerce filter panel usable on mobile devices.
Handle WooCommerce-specific edge cases
Variable products
Decide whether the index contains parent products, individual variations, or both. If shoppers filter by variation-level size or color, indexing only the parent product can produce incorrect results unless the parent record contains an accurate aggregation of every available variation value. If variations are indexed separately, use a shared parent identifier and deduplicate or group results in the presentation layer when necessary.
Stock and visibility
Index only products that should be discoverable, or add a filterable visibility field that excludes catalog-hidden products. Keep stock status synchronized with WooCommerce so an “in stock” facet does not return stale products. If backorders, preorder states, or location-specific inventory matter, model those states explicitly rather than reducing them all to a single Boolean.
Categories and hierarchical navigation
WooCommerce categories are hierarchical, so a flat category facet can be difficult to navigate. Algolia’s hierarchical facet pattern can represent levels such as categories.lvl0, categories.lvl1, and categories.lvl2. Populate these fields consistently from the product’s category path and configure the corresponding attributes for faceting.
Keep the URL and accessibility in sync
Every selected facet should be representable in the URL, such as ?brand=northstar&color=black. This makes filtered catalog views shareable, supports browser navigation, and gives agencies a predictable way to integrate server-side rendering or progressive enhancement. Encode arrays consistently and validate values against the allowed facet vocabulary before sending them to Algolia.
Facet controls should use real form controls with associated labels. Checkbox groups work well for multi-select facets, while a single-select control is appropriate when only one value is valid. Announce result-count changes to assistive technologies, provide a clear way to remove an individual refinement, and include a “Clear all filters” action when any filter is active.
Test facet behavior with representative catalog data
Test more than whether a filter returns a response. Verify that:
- Products with multiple values match every expected value.
- Two values in one facet use OR behavior, while different facets use AND behavior.
- Price ranges include their boundary values correctly.
- Variation attributes reflect actual purchasable combinations.
- Facet counts update after each refinement.
- Selected filters survive pagination, sorting, refreshes, and shared URLs.
- Out-of-stock and hidden products cannot reappear through a stale index record.
For agencies, facet configuration belongs in the same deployment process as the WooCommerce integration. Version the index settings, document the source of each indexed attribute, and add reindexing and synchronization checks to launch and maintenance procedures. A useful facet system is not simply a collection of checkboxes; it is a carefully modeled contract between the product catalog, Algolia’s index, and the shopper interface.