Filter
Represents a filter used to refine product listings, such as by price, manufacturer, or attribute.
Type Definition
type Filter {
label: String
maxValue: FilterValue
minValue: FilterValue
paramName: String
rangeMax: Float
rangeMin: Float
type: String
values: [FilterValue]
taxonomyAttribute: ProductTaxonomyAttribute
}
Fields
Field | Type | Nullable | Description | Related Type |
---|---|---|---|---|
label | String | Yes | The display name for this filter. Only attribute filters are localized. Useful for UI labels. | — |
maxValue | FilterValue | Yes | For range filters, the maximum selectable value for this filter. | FilterValue |
minValue | FilterValue | Yes | For range filters, the minimum selectable value for this filter. | FilterValue |
paramName | String | Yes | The query parameter name used for this filter in URLs and API requests. | — |
rangeMax | Float | Yes | The highest possible value for this filter if it is a range type. | — |
rangeMin | Float | Yes | The lowest possible value for this filter if it is a range type. | — |
type | String | Yes | The type of filter, such as 'list' or 'range' . | — |
values | [FilterValue] | Yes | The available selectable values for this filter, such as options or attribute values. | [FilterValue] |
taxonomyAttribute | ProductTaxonomyAttribute | Yes | The taxonomy attribute associated with this filter, if applicable. | ProductTaxonomyAttribute |
Relationships
- maxValue and minValue relate to the
FilterValue
type, representing the boundary values for range filters. - values is a list of
FilterValue
objects, representing selectable options for list-type filters. - taxonomyAttribute connects this filter to a
ProductTaxonomyAttribute
, providing semantic context for attribute-based filters.
These relationships allow clients to traverse from a filter to its detailed value options and associated taxonomy metadata.
Usage Examples
Basic Query
Fetch basic filter information including label, type, and parameter name:
{
filters {
label
type
paramName
}
}
Field Selection
Retrieve detailed information for a range filter including min/max values and range boundaries:
{
filters {
label
type
paramName
minValue {
label
value
}
maxValue {
label
value
}
rangeMin
rangeMax
}
}
Nested Queries
Access nested values and taxonomy attribute details for a list-type filter:
{
filters {
label
type
values {
label
value
count
}
taxonomyAttribute {
id
name
description
}
}
}
Filtering and Sorting
Assuming the API supports filtering and sorting on filters by type
and label
, here is an example query to fetch only range filters sorted by label ascending:
{
filters(filter: { type: "range" }, sort: { field: "label", direction: ASC }) {
label
type
paramName
rangeMin
rangeMax
}
}
Implements
The Filter
type does not implement any interfaces.
Connections
This type does not define any connection fields itself, but it is commonly used within product listing queries to provide filtering capabilities.
Related Types
- FilterValue: Represents individual selectable values or boundaries for filters.
- ProductTaxonomyAttribute: Provides taxonomy metadata associated with attribute filters.
Best Practices
- Use the
paramName
field to construct URL query parameters for filtering product listings. - For range filters, always check for the presence of
minValue
andmaxValue
to display correct slider boundaries. - When rendering UI, prefer the localized
label
field for user-facing text. - Use the
values
array to populate selectable options for list-type filters. - Leverage
taxonomyAttribute
to understand the semantic meaning of attribute filters and improve filtering UX. - Apply filtering and sorting on the server side to optimize performance and reduce payload size.
Notes
- All fields in the
Filter
type are optional and may benull
depending on the filter configuration. - The API currently requires no authentication, but this may change in future versions.
- When querying nested fields like
values
ortaxonomyAttribute
, consider the impact on query complexity and response size. - Caching filter data on the client side can improve performance, especially for static or rarely changing filters.
- No computed or derived fields are defined on the
Filter
type. - No field arguments are defined on the
Filter
type fields.
For any questions or issues, please refer to the API changelog and keep your queries optimized for the best performance.