Storefront filtering is the recommended method for filtering products in a theme. It allows merchants to [easily create filters](https://help.shopify.com/manual/online-store/themes/customizing-themes/storefront-filters#add-filters) for filtering collection and search results pages. Filters can be based on the following product and variant data: - Availability - Category - Price - Product tags - Product type - Vendor - Variant options - Metafields Filters are applied with `AND` logic, and filter values with `OR`. For example, you can return products that are a specific color _and_ a specific size, or you can return products that are one color _or_ another. When filters are applied, they're reflected in the collection or search URL through [URL parameters](#filter-url-parameters). ## Implementing storefront filtering Use the following resources to learn how to implement storefront filtering in your theme.
Component | Required | Description |
---|---|---|
filter |
Yes | The default namespace for filter URL parameters. |
filter_scope |
Yes |
The scope of the filter. Can be either of the following:
|
attribute |
Yes | The attribute the filter is based on. To learn more about the available attributes, refer to Filter types. |
attribute_scope |
No | The attribute scope for option and price attributes. To learn more, refer to Variant-specific filters |
value |
Yes | The filter value. To learn more about the value format, refer to Filter types. |
Name | Description | Parameter name | Accepted parameter value |
---|---|---|---|
Category | Filter based on specific product categories. | t.category |
A single category ID or a For example , |
Product tags | Filter based on specific product tags. | tag |
A single product tag, or a comma-separated list of product tags. For example |
Product type | Filter based on specific product types. | product_type |
A single product type, or a comma-separated list of product types. For example |
Vendor | Filter based on specific vendors. | vendor |
A single vendor, or a comma-separated list of vendors. For example |
Metafield |
Filter based on a specific product metafield. Metafield-based filters can reference metafields of the following types:
Metafield-based filters also need to specify the metafield namespace and key for the For example, if your metafield has a namespace of
|
m |
A single metafield value, or a comma-separated list of metafield values. For example, Note: A comma-separated list of metafield values is a list of individual metafield values, not a single metafield value that contains a comma-separated list. |
Name | Description | Parameter name | Accepted parameter value |
---|---|---|---|
Availability | Filter based on variant availability. | availability |
Either of the following:
|
Variant option |
Filter based on a variant option, such as Size or Color. Variant option filters also need to specify the option name for the For example, |
option |
A single variant option value, or a comma-separated list of variant option values. For example |
Price |
Filter based on variant price. Price filters also need to specify the price condition for the
|
price |
A single monetary value in the format of the shop's default currency. For example |
Standard product attribute |
Filter based on a product metafield generated for a standard product attribute that can be connected to product options. Standard product attribute metafield-based filters reference standard metafields of type Standard product attribute metafield-based filters also need to specify the For example, if your standard product attribute metafield has the key |
t |
A single metaobject GID, a comma-separated list of metaobject GIDs, a single taxonomy value GID, or a comma-separated list of taxonomy value GIDs For example, |
Metafield |
Filter based on a specific variant metafield. Metafield-based filters can reference metafields of the following types:
Metafield-based filters also need to specify the metafield namespace and key for the For example, if your metafield has a namespace of
|
m |
A single metafield value, or a comma-separated list of metafield values. For example, Note: A comma-separated list of metafield values is a list of individual metafield values, not a single metafield value that contains a comma-separated list. |