Storefront filter - Combine Variant and Product Metafields in single filter

Hi,

I want to use store front filtering to filter products and variants with one filter.

Example: I want to filter clothes by color, where some products have different color variants and some products just have their own intrinsic color. I want to choose ‘Blue’ and see only Blue Jeans, Blue Shirts and Blue Shirts.

I understand that I could do this by making a single variant for products which have no variants and applying the metafield at a variant level but this is a workaround not a valid solution. I don’t want to have many products where I have to have an extra level for no purpose. It will look bad on the product page, create extra work creating the variants and create extra levels in our POS system.

Online_Seller

4 Likes

Anyone? I’m looking for the same solution.

Have you found the answer?

Nope

Online_seller

Looks like I have found the solution.

for filters, you specify an array. In that array, you give the productMetafield objects. Metafields with the same namespace and key will be combined using OR operator and metafields with different namespace or/and key will be combined using AND operator

In the example below I am filtering products that are either brown OR gray and in my case, I receive 2 products

And in the following example, I am filtering products that are shirt AND brown and in my case I receive 1 product