Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Multiple Filters on Collection Products

Multiple Filters on Collection Products

niko7o
Shopify Partner
1 0 0

Heya,

 

I'm trying to query for some collection products given a group of filters. For some reason, these queries get filtered as expected if only one filter is used, but as soon as I provide 2 or more filters as parameters, the results aren't excluded & return completely randomly.

 

image.png

I found some related threads that suggested to enable the Search & Discovery app, but even with it installed & configured, I can only filter with one input or another.

 

https://github.com/Shopify/hydrogen/discussions/490

 

Any clues? How can i filter for the products of a collection with 2 or more parameters? (i.e: with a tag "lorem" & a price below "200")

Reply 1 (1)

oscprofessional
Shopify Partner
16257 2430 3156

Hi @niko7o ,

Please use this query this might be helpful for you,

{
  collectionByHandle(handle: "summer-collection") {
    id
    title

  }
  products(first: 10) {
    nodes {
      options {
        id
        values
      }
    }
  }
  productVariants(first: 10, query: "price:<50", sortKey: TITLE){
    edges{
      node{
        price
        title
        id
        metafields(first:5){
          edges{
            node{
              id
              namespace
              key
            }
          }
        }
      }
    }    
  }
}

 

Please let me know if you need any more suggestions.

 

Thanks....

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free | OSCP Shipping Discounts App : Free