Checking if an item is listed in the Sales Channel

Highlighted
Excursionist
17 0 4
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!
0 Likes
Shopify Partner
57 3 3

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.

0 Likes