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

Getting different response #1042

Closed Komal2905 closed 4 years ago

Komal2905 commented 4 years ago

I need to get product which are in stock When I run

{
  products(first: 10, reverse: false, sortKey: TITLE, query: "inventory_total:0") {
    edges {
      cursor
      node {
        id
        title
      }
    }
  }
}

in shopify-graphiql-app , I get proper result.

but when I use same query in mobile app, the condition in query is getting ignored, and app received all product which have inventory_total > 0

dbart01 commented 4 years ago

Could you please provide the query that you've built using the Buy SDK query builder?

Komal2905 commented 4 years ago

@dbart01

{shop{name,paymentSettings{currencyCode,countryCode}},products(first:10,reverse:false,sortKey:TITLE,query:"inventory_total:0"){edges{cursor,node{id,title,description,descriptionHtml,vendor,productType,createdAt,updatedAt,tags,images(first:1){edges{node{id,originalSrc,altText}}},variants(first:250){edges{node{price,availableForSale}}},options{id,name,values}}}}}

this is the build query

dbart01 commented 4 years ago

Please use available_for_sale:false instead. As per the query parameter documentation:

Screen Shot 2019-12-12 at 8 20 19 AM

Komal2905 commented 4 years ago

@dbart01 Thank you so much :) I was struggling for 2 days to achieve this