Recommendation filtering

How is it working

Each filter is a rule that is applied to an array of products. Each rule has 5 actions available: pin, exclude, include, push to top, push to bottom. For each action, you define product attribute values that will be used to identify products. Almost all product attributes are available (there are some exceptions like description) as well as custom fields.

If there are multiple filters defined, they are executed in the following order sequentially:

  • pin
  • exclude
  • push to the bottom
  • push to the top
  • include

After the initial filtering, the products are bucketed into a set of groups for each action in the following order:

  1. pinned
  2. pushed to top
  3. included
  4. pushed to bottom

Inside of buckets 2-4, the products are sorted according to their search relevancy. Pinned products are sorted according to the pinned order, ignoring their relevancy.

This means that if you define both exclude and include actions, from the resulting array of products, products that fall under exclude action will be removed first and then the ones that fall under include action will be left.

Here are examples of rules that can be applied:

  • Include products only from certain brand
  • Include products only from certain category
  • Exclude products of certain brand
  • Exclude products by ID
  • Push to top products of certain brand and with quantity > 10 to top

'Current value' integration

When using the current value option, a specific integration needs to be done on the frontend in order to capture the current value of a custom field.

This is done by applying extra tags on the recommendation container, the generic structure looks like this

<div data-findify-filter="FIELD_NAME" data-findify-filter-value="FIELD_VALUE" />

For the FIELD_NAME you need to put the name of the field to filer, e.g. brand, category, custom_fields.width. The value inside data-findify-filter-value tag contains a JSON object in the form of VALUE.

The full example will look similar to this one

<div data-findify-filter="brand" data-findify-filter-value="Adidas" />

If you want to add multiple values for brands, you would need to wrap it up with stringified json:

<div data-findify-filter="brand" data-findify-filter-value='[{"value":"addidas"},{value:"nike"},...]'></div>

Let's say that you have a custom field called 'Gender'. You can setup a tag using this custom field as well (make sure that the name of the filter is the same as it is stored internally in Findify):

<div data-findify-filter="custom_fields.Gender" data-findify-filter-value="Men" />

For the category if the current item is part of a nested category, you need to pass multiple items inside the value array

<div data-findify-filter="category" data-findify-filter-value="CategoryParent > CategoryChild" />

Example of how to provide values from Shopify tags with a prefix

{% assign typeTags = "" %}

{% for tag in product.tags %} 
  {% if tag contains "type:" %}  
    {% assign t = tag | remove: "type:" | strip | capitalize %}
    {% assign typeTags = typeTags | append: "," | append: t %}
  {% endif %} 
{% endfor %}

{% if typeTags != "" %}
    {% assign splitTypeTags = typeTags | remove_first: "," | split: "," %}
    <div data-findify-filter="custom_fields.custom_field" data-findify-filter-value='[{% for tag in splitTypeTags %}{"value":"{{ tag }}"}{% if forloop.last == false %},{% endif %}{%endfor%}]'></div>
  {% endif %}