Storefront filter - Combine Variant and Product Metafields in single filter

Online_Seller
Shopify Partner
51 1 90

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

Replies 4 (4)

zyla999
Shopify Partner
13 0 6

Anyone?   I'm looking for the same solution. 

sher-bakhodirov
Shopify Partner
7 0 3

Have you found the answer?

Online_Seller
Shopify Partner
51 1 90
Nope

Online_seller
sher-bakhodirov
Shopify Partner
7 0 3

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

sherbakhodirov_0-1680894800666.png

 

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

sherbakhodirov_1-1680894976174.png