Storefront filtering: metafields

Hi everyone,

Hope you are all doing well !

I have a question about the storefront filtering.
On the Shopify documentation (https://shopify.dev/themes/navigation-search/filtering), on the “Filter Types / Produt-specific filters” section, I can see on the table that for the Metafield, we can put a single metafield value, or a comma-separated list and use it to filter products.

I tried it, by selecting the “single_line_text_field”, but it doesn’t seem to work as expected. In fact, if I put for example, “canada,usa” (a comma separated list) on my product metafield, the behavior we are trying to have is the filter option “canada” and the filter option “usa” available on our filters list. The behavior we actually have is the option “canada,usa” on our filters list (see screenshots below).

Is it normal ? Did I miss something or maybe my understanding of the documentation isn’t the good one?

Thanks in advance

4 Likes

Hi,

I have the same problem and I really need to use comma separated values for some of my metafields.

Did someone found a workaround ?

Thanks

I’m facing same issue, didn’t find any workaround, did you ?

Still no solution for me :(.

And it seems the shopify team doesn’t care about this problem, not even one official intervention from the team in 4 months…

It seems like the Shopify docs are incorrect on this. I had the same issue but came up with a workaround. It does require some liquid and javascript knowledge though, so it’s not a simple update to make.

I’ve written up a blog post on it in case it helps anybody here: https://iamketan.design/blog/shopify-filters-metafields

It looks like Shopify has recently solved this problem in their April 6th changelog by allowing to create multiple values for the single line text field.

Changelog summary here: https://changelog.shopify.com/posts/metafield-improvements-metafield-lists

Update definition in Shopify Help Center: https://help.shopify.com/en/manual/metafields/metafield-definitions/metafield-types#metafield-lists

This should work out of the box for all 2.0 themes.

1 Like