Using recommendation filters
Filter recommendation results using an exact term or a numeric range filter. You can place these filters at the request level or the widget level. We recommend using request-level filters because you can apply the filter to all widgets in a batch request.
You can also apply filters for product or SKU-level attributes, including locale or store-specific attributes.
The following sections show some examples of filters for recommendations.
Exact term filtering on the homepage widget
The following code shows a request for exact term filtering. In this example, you filter on the homepage widget for medium (M) or large (L) products.
{
"widget": {
"rfkid": "rfkid_1"
},
"filter": {
"size": ["M", "L"]
},
"content": {"product": {}},
"n_item": 16
}Exact term filtering on the PDP widget
The following code shows a request for exact term filtering. In this example, you filter on the PDP widget for red (rouge) or blue (bleue) products for the French variant of the site.
{
"widget": {
"rfkid": "rfkid_31"
},
"filter": {
"color": ["Rouge", "Bleue"]
},
"context": {
"page": {
"locale_country": "ca",
"locale_language": "fr"
}
}
"content": {"product": {}},
"n_item": 16
}Numeric range filtering on the PDP widget
The following code shows a request for numeric range filtering. In this example, you filter on the PDP widget for products with final_price between 10 and 50.
{
"widget": {
"rfkid": "rfkid_32"
},
"filter": {
"final_price": {"min": 10, "max": 50}
},
"content": {"product": {}},
"n_item": 16
}
Filtering on cart widget for products matching a specific fitment
The following code shows a request for filtering on the cart widget. In this example, you filter on the cart widget for products matching a specific fitment for the automotive industry.
{
"widget": {
"rfkid": "rfkid_4"
},
"context": {
"fitment": {
"ids": ["fit-id1", "fit-id2",...]
}
},
"content": {"product": {}},
"n_item": 16
}