Re: [2.0] Age group filtering with Metafields

[2.0] Age group filtering with Metafields

nosenation
Shopify Partner
6 0 7

Hi
I have a store where age groups filtering is core functionality. Example age groups: 1 year +, 2 years +, 3 years + etc. Those groups mean that product is for at least X years old kids, NOT only for X years old ones. Obvious one is that 1 product can be assigned to multiple product groups (1y, 2y, 3y etc.). I would like to have this kind of functionality in 2.0 shopify generation theme.

I know that filters just recently received a small update with support for product metafields. Cool, but still lacking few things for my use case. Now I can create a value that looks like this: "1 year +, 2 years +" but the filtering system recognizes this whole string as 1 single value. Not a list of comma separated ones.

Do you have any kind of solution for this "specific" type of filtering?

Lack of normal tags filtering is hurting badly, but metafields would also work fine if "fixed" a little.

Replies 19 (19)

Jesse_Michel
Shopify Partner
21 0 6

I was about to post about the exact same issue. Did you ever find a solution?

- Jesse Michel | Shopify Expert
nosenation
Shopify Partner
6 0 7

Nope, still nothing. Shopify should support multiple values per 1 metafield (like a list of values separated with comma).

amorlett
Shopify Partner
186 12 34

adding + kinda confuses shopify try 1Plus or 1_plus  instead.. also you can look into adding filters via tags 

Jesse_Michel
Shopify Partner
21 0 6

Yeah Shopify kind of seems like it's trying to move us away from filtering with tags. Their documentation explicitly notes that you cannot use their new filters in conjunction with tag filters. From a data perspective, it makes a lot more sense to filter by metafields, but they really need to support filters for multiple values on a single field, otherwise it's a pretty big step back. I'm guessing there may be a way to work around this but for now this means I'll need to use Boosts Product Filter & Search instead of the built in filters, unfortunately, just so I can have this feature.

- Jesse Michel | Shopify Expert
amorlett
Shopify Partner
186 12 34

yeah trying to move away from tag filters as well but doesn't seem possible without integrating apps with graphQL which is a total shame and scam... it shouldn't be so complex to do something other platforms do easily and for free (no apps)

nosenation
Shopify Partner
6 0 7

adding + kinda confuses shopify try 1Plus or 1_plus  instead.. also you can look into adding filters via tags 

Tried it without + like "value, value2" and still same effect. For Shopify this kind of string is always 1 value.

 

yeah trying to move away from tag filters as well but doesn't seem possible without integrating apps with graphQL which is a total shame and scam... it shouldn't be so complex to do something other platforms do easily and for free (no apps)

I agree. This should be a built-in functionality. I don't want 3rd party apps for functionalities that are common in other ecommerce platforms.

Kromann
Visitor
2 0 1

This is also something that makes the new filters irrelevant for us, unfortunately.

There are many instances where a product need multiple values for the same filter:

- Anything with a range, eg. socks (size 40-44). I need to parse those as '40,41,42,43,44' to be useful in a filter.

- Colors, eg. a shoe with two colors (red/blue). I need to parse those as 'red,blue'

- Anything that fits in multiple subcategories, eg. a shoe suitable for both running and training. I need to parse those as 'running,training'.

Looking forward to an answer from Shopify 🙂

amorlett
Shopify Partner
186 12 34

you can do capture at that point or make your own custom metafields 

Kromann
Visitor
2 0 1

@amorlett Not sure I understand your reply. Can you already do this? It looks like the new filtering supports comma-separated values (see under 'Accepted Values here: https://shopify.dev/themes/navigation-search/filtering). I just tested this with the new Dawn theme and that has no support for it. However, it does look like the limitation is at the API level. Is the documentation/API correct?

SDCOpartners
Tourist
3 0 1

We're having the same issue. Tried both versions of filtering by multiple values of the same metafield and nothing works. Documentation is incorrect, comma-separated list does not work. However, single values work fine. 

Edit: It actually isn't limited to metafields. Multiple product options don't work with either solution provided in the docs. 

SDCOpartners
Tourist
3 0 1

Update: I discovered the comma separate metafield values actually works on the development site, however it does not work locally using Shopify CLI's Theme Serve. 

Works: 
https://[shopname].myshopify.com/collections/all-products?filter.p.m.styles.color=Black,Red

Doesn't work: 
http://127.0.0.1:9292/collections/all-products?filter.p.m.styles.color=Black,Red

Robert_Kanaan
Shopify Partner
61 8 18

@SDCOpartners ,

 

When you say it works, is "Black,Red" being treated as a single value, or two separate values.

 

From my testing, it is being treated as a single value. 

Robert Kanaan | Web Developer @ GoVedia
Building apps & custom solutions
robert@govedia.com
https://govedia.com
nosenation
Shopify Partner
6 0 7

Hmm example you mentioned is connected with Color. Maybe it will work if you use "standard" variant types, like product color, but not the custom ones (like Age).

SDCOpartners
Tourist
3 0 1

@Robert_Kanaan for metafields it's being treated as two separate values. Alternatively:

https://[site].myshopify.com/collections/all-products?filter.p.m.styles.color=Black&filter.p.m.style...

Works as well. However, neither works if you're using Shopify CLI and testing on your localhost. 

Robert_Kanaan
Shopify Partner
61 8 18

@SDCOpartners From my testing, comma delimited is not a supported option for custom metafield filters. Not on a development store or otherwise.

 

It would be wonderful to see this working, so I'm curious to learn more.

 

Could you provide URL to your dev site, so I could have a look? 

Robert Kanaan | Web Developer @ GoVedia
Building apps & custom solutions
robert@govedia.com
https://govedia.com

elmashad
Shopify Partner
1 0 0

I'm experiencing the exact same issue. There doesn't seem to be a fix for this yet. Not supported in the dawn theme or the Canopy which I'm using. Does anyone use an app for this? Although that's definitely not my preferred option, but filters are very limited since Shop 2.0 

Jesse_Michel
Shopify Partner
21 0 6

For my money Product Search & Filter is the best filter/search app: https://apps.shopify.com/product-filter-search

 

But I agree, I'd rather go with the off-the-shelf features where possible.

 

The other issue is they don't offer any bulk features with metafields (import, export, updates). I'm hoping some of this stuff is in the works.

- Jesse Michel | Shopify Expert

Ketan_Mistry
Shopify Partner
19 0 7

I've had to implement this on a client's website. It can be done, but it requires some liquid and javascript knowledge. I've written up a blog post on how I got it working if you are interested: https://iamketan.design/blog/shopify-filters-metafields

I'm a British Web Designer/Developer and Graphic Designer with 20+ years of industry experience currently residing in Cairns, Australia.

illyilly
Tourist
6 0 4

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.