Shopify / mobile-buy-sdk-ios

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.
MIT License
452 stars 199 forks source link

Fetch Products based on specific variants. #986

Closed MVakas closed 5 years ago

MVakas commented 5 years ago

Hi I want to fetch products based on some condition on their variants. Like the products where variants inventoryQuantity is 1 etc. How may I achieve this?

MVakas commented 5 years ago

The following isn't working.

{
  products(first:30, query:"inventoryQuantity:1") {

    pageInfo {
      hasNextPage
    }
    edges {
      cursor
      node{
        id
        title
        vendor

        variants(first: 5){
          edges {
            cursor
            node {

              availableForSale
              inventoryQuantity
            }
          }
        }
      }
    }
  }
}
dbart01 commented 5 years ago

What you're looking to do is currently not possible. The query parameter on products only operates on properties of a Storefront.Product, not its variants or other fields.