The filter object

The filter object represents a storefront filter.

The filter object has the following attributes:

filter.active_values

Returns an array of filter_value objects that are currently active. Only applies to list type filters.

filter.inactive_values

Returns an array of filter_value objects that are currently inactive. Only applies to list type filters.

filter.label

Returns the customer-facing label for the filter.

filter.max_value

Returns a filter_value object for the maximum value of price_range type filters.

filter.min_value

Returns a filter_value object for the minimum value of price_range type filters.

filter.param_name

Returns the name of the filter. For example, filter.v.option.color.

filter.range_max

Returns the maximum product price within the current collection. This is only valid for filters of type price_range.

filter.type

Returns the filter type. Can be list or price_range.

filter.url_to_remove

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

For example, the following shows a URL with a Color filter of red, as well as a Size filter of L applied:

If you want to remove the Color filter, then the url_to_remove attribute returns the following URL:

filter.values

Returns an array of filter_value objects for a list type filter.