Skip to Content

Filter

The filter object describes a product or collection filter, including its type, available values, and range information.

Usage Example

{%- comment -%} Display all filters and their values {%- endcomment -%} {% for filter in collection.filters %} <h3>{{ filter.label }}</h3> <ul> {% for value in filter.values %} <li> <a href="{{ value.url_to_add }}">{{ value.label }}</a> {% if value.active %}(Active){% endif %} ({{ value.count }}) </li> {% endfor %} </ul> {% endfor %}

Properties

active_values

Returns the active values for this filter.

inactive_values

Returns the inactive values for this filter.

label

Returns the label for this filter. Only attribute filters are localized.

max_value

If this filter is a range type, returns the maximum value for this filter.

min_value

If this filter is a range type, returns the minimum value for this filter.

param_name

Returns the query parameter name for this filter.

range_max

If this filter is a range type, returns the possible maximum value if available.

range_min

If this filter is a range type, returns the possible minimum value if available.

taxonomy_attribute

Returns the taxonomy attribute if this filter is a taxonomy filter.

type

Returns the filter type.

url_to_remove

Returns the current page URL with the filter’s currently applied value parameters removed.

values

Returns values for this filter.

Last updated on