Checking if an item is listed in the Sales Channel

Sterling_Smith
Excursionist
19 0 6
Hi, kinda quick question.
 
Is there a way to check if a store has listed any given item in your app's sales channel before using the storefront api to attempt to retrieve it's full details?  For example, when pulling in a list of items by collection, some of the items returned are not properly listed in the sales channel, so when moving to fetch the full details/variants, an error occurs.  Is there any way to see if that's the case so I could, for example, not display them in the results?  Thanks!
Reply 1 (1)

Matt_eman
Shopify Partner
61 3 5

If you are using graphQL you can query like this

 

 query { 
    products(first: 20, query: "published_status:published") {
      edges {
          node {
           title
         }
       } 
   }
}

 

This query would only return products from the API that are published.