Is it possible to use metafields with the where filter?

Topic summary

Goal: Filter collection products by a product metafield (custom field) using Liquid’s where filter to hide/show items beyond the standard collection UI.

Status: Not supported natively. A response states Shopify’s Filter 2.0 does not support filtering by metafields, and the proposed Liquid approach is not possible.

Alternatives: Use third‑party filtering/search apps.

  • Suggested apps: “Product Filter & Search” and “Ultimate Search & Filter”.
  • Example setup (Ultimate Search & Filter):
    • In the app, go to App Settings → Search Index.
    • Add the product or variant metafield (namespace + key).
    • Run Sync.
    • Go to Filter groups → choose a group → add a new filter and select the metafield from the dropdown.

Outcome: No native Liquid/Filter 2.0 solution; app-based filtering by metafields is the recommended path. The thread remains open-ended with app recommendations as the actionable resolution.

Summarized with AI on February 13. AI used: gpt-5.

I am trying to create a list of products filtered by their metafields.

For example:

{% assign products = collection.products | where: “metafields.my_fields.product_in_stock”, “1” %}

is something like this possible?

Or is there an alternative way to achieve the same thing? (a list of products filtered by the respective product metafields)?

The purpose of this is to allow me to not display certain objects in a collection with more control than is offered in the current “collection” UI.

Hi @ohreallyhmmmm ,

This is not possible, filter 2.0 does not support it. You can only do this with the app, Refer app: https://apps.shopify.com/product-filter-search

Hope it helps!

In order to filter products by metafields correctly, you can use this app https://apps.shopify.com/ultimate-search-and-filter-1. You can add metafields to filter in this app by following the steps below:

  • Go to App Settings => Search Index in the app

  • Add a product or variant metafield with namespace and key

  • Hit Sync button

  • Go to Filter groups => choose a filter group => add a new filter and select your metafield from the dropdown