There may be instances where the facets appear to not be displaying all of the available options. For instance, an e-commerce shop may have shoes of sizes 8, 9, 10, 11, 12, and 13. However, it's possible only 10, 12, and 13 are displayed despite the remaining sizes being in-stock.
This can occur if "Show products instead of variants" has been selected.
When the query is sent, the query-time parameter "facetingAfterDistinct" is set to true. This means that the search is first performed, then the size variants are deduplicated, and then the facet sizes are determined (in that order.) So the front-end is essentially receiving de-duplicated facet counts.
This can be changed by altering the algolia_instant_search.js file in the theme code to set the "facetingAfterDistinct" parameter to false at query time. So within the addWidgets function in that file, it should read:
This will ensure the facets are determined prior to the results being deduplicated. Please bear in mind, however, that the sum of all facet counts may now exceed the number of displayed results.
Last reviewed 06-05-22.
Article is closed for comments.