Re: Querry to search for all products

Querry to search for all products

Censoretti
Shopify Partner
6 1 2

im trying to search all products in some store, the piece of code that do that is this:

```

for(let i = 0; i < 2; i++ ){

    resProds[resProds.length] = await client.query({
      data: queryProds,
      variables: { cursor: cursorProds}
    })
    cursorProds = resProds[resProds.length - 1].body.data.products.pageInfo.hasNextPage != true ? resProds[resProds.length - 1].body.data.products.pageInfo.endCursor : null

}

```
the response of this is always the same, it never changes, even if i put the next cursor on cursor as a string, and i dont know why, dont know even how to debug this, could someone help me?

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 509

Hey @Censoretti - could you let us know which queries you're making (for example, how the queryProds object is defined in your code, are you using GraphQL/REST)? If you can share the response you're receiving (with any shop-sensitive details edited out), that would be helpful as well. Without knowing too much about the way you've built the specific Product API queries, we're unable to look into this too deeply, but if you're able to share the above information, we're happy to take a closer look. 

Hope to hear from you soon!

 

Al | Shopify Developer Support

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog