Skip to content

Filter

The Filter object represents a single list filter in the storefront.

classDiagram
  direction LR
  Filter --> FilterValuesList
  class Filter{
    string name
    bool isActive
    bool hasCounters
    bool isSingleChoiceOnly
    FilterValuesList values
  }
  class FilterValuesList{
  }

Properties

Attribute name Type Description
name string The name of the filter.
isActive bool Returns true when filter is active.
hasCounters bool Returns true when filter has counter.
isSingleChoiceOnly bool Returns true when filter is single choice.
values FilterValuesList The FilterValuesList object that represents list of FilterValue object.

Examples

name property

{{ filter.name }}
example name

isActive property

{{ filter.isActive }}
true

hasCounters property

{{ filter.hasCounters }}
true

isSingleChoiceOnly property

{{ filter.isSingleChoiceOnly }}
true

values property

{% for filter in filter.values %}
  <p>name: {{ filter.name }}</p>
{% endfor %}
<p>name: example filter name 1</p>
<p>name: example filter name 2</p>
<p>name: example filter name 3</p>