Examples: sizes and colors
Apparel often comes in specific shades like ruby, crimson, scarlet, burgundy, or cherry. Using the color attribute for faceting would create too many options. Each option might then return only a few results. Instead, you can use the essential color red as attribute for faceting. Another example is shoe size, where the same sizes can be expressed in multiple formats:- Letters: S, M, L
- Numerical systems: Mondopoint, EU, UK, US
- Alphanumeric: B10
Create custom attributes for facet bucketing
First, create your custom attribute for the Product system object. Go to Business Manager > Administration > Site Development > System Object Types > Product. Select a custom attribute such asrefinementColor or refinementSize.
For example, the custom attribute refinementColor has the type enum of string.
It has predefined values to choose from, and you can change the list of values.
You can select any type supported by Salesforce B2C Commerce.


Add custom attributes to additional product attributes
Go to the Algolia BM module (BM > Merchant Tools > Algolia > Algolia). Add your custom attribute to the Additional Product Attributes field. Use the pre-configured name if the attribute is part of the configurable attributes. Otherwise, use its full path, such ascustom.myCustomAttribute.
Create a new refinementList widget
After creating the custom attribute,
adding the values to your products,
and exporting it to Algolia,
you can create a new refinementList widget.
This widget lets your users filter the search results based on this new attribute.
Create a new refinementListWithPanel widget in instantsearch-config.js:
JavaScript
div element for your new widget in the file searchResultsNoDecorator.isml as well.
After adding the new refinementList widget, your users can filter products by the more generic color groups.
The following example shows a storefront with two filtering options.
The first Colors widget (refinementList) lists specific shades and color terms.
The second Colors widget (custom.refinementColor) only lists primary colors:
