Collection has 1100 products. Storefront graphql only returns 750 using cursor pagination

Here is my first query:

query MyQuery {
  collection(handle: "women") {
    products(
      first: 250
      sortKey: ID
    ) {
      edges {
        node {
          id
          handle
          variants(first: 20) {
            edges {
              node {
                id
                title
              }
            }
          }
          id
          handle
        }
        cursor
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

I get 250 products and an end cursor. My next query is:

query MyQuery {
  collection(handle: "women") {
    products(
      first: 250
      after: "eyJsYXN0X2lkIjo3ODUyMzU0OTk0NDE0LCJsYXN0X3ZhbHVlIjoiNzg1MjM1NDk5NDQxNCJ9"
      sortKey: ID
    ) {
      edges {
        node {
          id
          handle
          variants(first: 20) {
            edges {
              node {
                id
                title
              }
            }
          }
          id
          handle
        }
        cursor
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

and I end up getting a cursor which I use in the next query:

query MyQuery {
  collection(handle: "women") {
    products(
      first: 250
      after: "eyJsYXN0X2lkIjo3ODUyNDQzMDA5MjYyLCJsYXN0X3ZhbHVlIjoiNzg1MjQ0MzAwOTI2MiJ9"
      sortKey: ID
    ) {
      edges {
        node {
          id
          handle
          variants(first: 20) {
            edges {
              node {
                id
                title
              }
            }
          }
          id
          handle
        }
        cursor
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

This query tell me there is not a next page and when I use its cursor, there is indeed nothing after it.

Why can’t I get all 1100 products in my collection?

Hi @Schmidtc63 !

The Storefront API will only pull products that would display on the storefront. Unlike the similar collection query from the Admin API which will return every product from a collection, products that have status=DRAFT, for example, will not appear in Storefront API version of the query.

That doesn’t even begin to answer my question. My collection has 1100 available products. Using the storefront graphql api, I can only get 750 of them to display. That is the issue.

because your

after: "eyJsYXN0X2lkIjo3ODUyNDQzMDA5MjYyLCJsYXN0X3ZhbHVlIjoiNzg1MjQ0MzAwOTI2MiJ9"

is not change, this ‘after’ is the last list value’s

cursor

so ,when you change ‘after’ == ‘cursor’ ,that may be you want.

You need to read the question.

Hi @Schmidtc63 :waving_hand:

In order to investigate this, we would need to take a closer look at the actual collection and determine which products are missing from the Storefront query. Would you please contact partner support to create a ticket using a partner account with access to this merchant store and collection? Please be sure to provide your api_client_id, shop_id, collection_id to the team as well.