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.

GraphQL, Best way to filter out selectedOptions from productVariants

GraphQL, Best way to filter out selectedOptions from productVariants

TylerMarshall
Shopify Partner
2 0 0

I am trying to build an app that shows low inventory of variants with a button action hooked up to my custom internal application.

 

I would like to show All Variants, of only a subset of selectOptions (colors).

 

My simple query currently looks like this:

          {
            productVariants(first:10, query:"inventory_quantity:<5") {
              edges {
                node {
                  inventoryQuantity,
                  selectedOptions {
                    name,
                    value
                  }
                  product {
                    title,
                    productType,
                  }
                }
                cursor
              }
              pageInfo {
                hasNextPage
                endCursor
              }
            }
          }

This returns all variations including all those with selectedOptions I don't want to see. I was playing around and I'm not sure I see a simple way to do this? I'm also fairly green to the GraphQL Tech as well.

 

Any help would be appreciated!

 

Thanks

 

Replies 0 (0)