---
description: >-
  The theme supports storefront filtering by Shopify. In the following article,
  you can learn how to apply filters for collection pages.
---

# How to set up filters?

{% embed url="https://www.youtube.com/watch?v=dUK8yR5Pkjw" %}

### Add default filters using the Shopify Search & Discovery app

Read the initial [<mark style="color:blue;">documentation</mark>](https://help.shopify.com/en/manual/online-store/search-and-discovery/filters) for filter configuration requirements.

Then, you can follow the listed steps to display filters:

#### **Step 1**

In your _Shopify admin -> Apps_, select the **Shopify Search & Discovery** app:

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2Fk94Plz1vwvLLRT9xklYk%2Fadmin_search%26discovery%20app.png?alt=media&#x26;token=8ba96b4e-4bd6-462e-b531-1ed87f3fbdaa" alt=""><figcaption></figcaption></figure>

#### **Step 2**

Then, you can press the **"Filters"** item in the side menu to navigate to the needed chapter:

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FRQfp3uEfYCd8GxSGcIqA%2Ffilters_chapter.png?alt=media&#x26;token=26a60cca-7c0a-4b83-8c30-ce449e02aec6" alt=""><figcaption></figcaption></figure>

#### **Step 3**

Press the **"Add filter"** button to view all the available filters:

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FfECYMhR8Ayb5kaoscdYT%2Fapp_add%20filters.png?alt=media&#x26;token=841ec543-07da-4de7-9ccc-036dd963069b" alt=""><figcaption></figcaption></figure>

#### **Step 4**

In the "Source" selector, you can choose filters that should be available in a storefront.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FVk43Mhw3fYA9nWNfBe6M%2Fapp_edit%20filters.png?alt=media&#x26;token=fef03921-9a63-45b6-baf6-64898d266c9e" alt=""><figcaption></figcaption></figure>

Add each filter one by one.

In the **"Filter label"** field, paste the name of the filter if necessary.

**Save the changes.**

{% hint style="warning" %}
**Note!** If you need to display filters for product options such as color, size, style, etc., add the desired options for products in _Shopify admin -> Products_:
{% endhint %}

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FDh05rxDt8GSZnofdPQT3%2Fadmin_product%20options.png?alt=media&#x26;token=6b5b87c8-f524-49c7-878a-b491d43e4e2e" alt=""><figcaption></figcaption></figure>

#### **Step 5**

The filters will be displayed in the same order as you set them up at the back end. If you need to change the filter's position in the sidebar, change the order in the app by dragging filters up or down:

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FNjGhbNcY8PkPBwUIL8MP%2Fapp_drag%20filters.png?alt=media&#x26;token=bea5002a-71ef-48ed-82c5-3090589f6904" alt=""><figcaption></figcaption></figure>

#### **Step 6**

Now you can go to _Theme Editor -> Collections -> Product grid ->_ [_<mark style="color:blue;">Filtering and sorting</mark>_](https://mpithemes.gitbook.io/unicorn-shopify-theme/page-categories/collections/product-grid#filtering-and-sorting) to make sure the filters displaying have been approved:

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FnVUYcCquwuI4DT9bCtxr%2Fproduct%20grid_enable%20filtering.png?alt=media&#x26;token=3ff32a38-7e76-4ac4-87b9-f2fb33331147" alt=""><figcaption></figcaption></figure>

### Create custom filters using metafileds

Previously in this article, you learned how to customize the standard filters on the storefront based on product information added in your admin, such as product vendor, type, and product variants. However, Shopify’s software has some limitations, allowing you to add up to three product variants in the admin for use as filters on the storefront. So, what if you need to add more filters that do not match product variants or there is no need to display them as product variants in your store? This can be achieved using metafields.

To display custom filters in a store, follow the steps below:

#### Step 1

Create a metafield in your _Shopify admin -> Settings -> Custom data -> Metafield definitions -> Products_ by hitting the **"Add definition"** button.

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>

We are going to create a metafield to display a filter by gender. An example of the metafield settings can be viewed below:

* Name - **Gender**
* Namespace and key - **my\_fields.gender**
* **Single line text** - **One value**

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FtxUHpH17sGNdtOpZTcfU%2Fadmin_metafield%20definition%201.0.png?alt=media&#x26;token=4d0f1b49-4535-4bc8-a455-fa63f1ef3723" alt=""><figcaption></figcaption></figure>

#### Step 2

Go to **"Products"** in your admin and assign filter items to products using the created metafield.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FigXUG6x5TLwisXPpcyeF%2Fadmin_link%20metafield%202.0.png?alt=media&#x26;token=941df0c6-b14b-4696-bc29-e50d083f1272" alt=""><figcaption></figcaption></figure>

Add an appropriate value to each product that needs filtering.

#### Step 3

To display the filter on the storefront, add a filter to the list of filters in the Shopify Search & Discovery app. Go to **Apps**, select the app, and press the **"Filters"** tab. Then, hit the **"Add filter"** button.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FfECYMhR8Ayb5kaoscdYT%2Fapp_add%20filters.png?alt=media&#x26;token=841ec543-07da-4de7-9ccc-036dd963069b" alt=""><figcaption></figcaption></figure>

#### Step 4

Next, select the filter in the **"Product metafields"** block by pressing the **"Source"** field.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FgVm9M780NYdcAf6KFJD2%2Fapp_add%20filter.png?alt=media&#x26;token=b05127d7-0e32-4df9-9d46-4df5950a4de2" alt=""><figcaption></figcaption></figure>

**Save the settings.**

Now, you can view the filter on the storefront:

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2Faye9Txhrto6ih9yinN4H%2Fgender%20filter_storefront.png?alt=media&#x26;token=06b67838-91fc-465e-a5f7-2c0d60aef569" alt=""><figcaption></figcaption></figure>
