Answers.Body: <p>Try using <a href="https://github.com/craftcms/cms/commit/1abd40e4fcf1bb01f488447b9d6d392a14d961ac" rel="nofollow noreferrer">_count</a> -- there are some examples here: <a href="https://github.com/craftcms/cms/issues/4847" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/4847</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-19T00:59:28.220Z
Answers.LastActivityDate: 2021-04-19T00:59:28.220Z
Answers.UserDisplayName: andrew.welch
Body: <p>I've got the GraphQL code posted below, but I'm not sure how do I count the total of returned products .
  Do I need another query just for the products without offset ? I need it for a pagination functionality</p>
  <pre><code>query Products($offset: Int, $priceBetween: [QueryArgument]) {
    products(limit: 9999, orderBy: &quot;dateCreated DESC&quot;, offset: $offset, defaultPrice: $priceBetween) {
      id
      defaultPrice
      title
      ... on furniture_Product {
        productThumbnail {
          url @transform(width: 300, immediately: true)
        }
      }
    }
  }
  </code></pre>
  
Tags: <craft3><graphql>
Title: Craft CMS GraphQL count query
ThreadText: # Craft CMS GraphQL count query
  
  (Asked by: username_0 on 2021-04-13)
  
  I've got the GraphQL code posted below, but I'm not sure how do I count the total of returned products .
  Do I need another query just for the products without offset ? I need it for a pagination functionality
  
  ```
  query Products($offset: Int, $priceBetween: [QueryArgument]) {
    products(limit: 9999, orderBy: "dateCreated DESC", offset: $offset, defaultPrice: $priceBetween) {
      id
      defaultPrice
      title
      ... on furniture_Product {
        productThumbnail {
          url @transform(width: 300, immediately: true)
        }
      }
    }
  }
  
  ```
  
  **Tags:** craft3, graphql
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-04-19. Score: 1
  
  Try using [\_count](https://github.com/craftcms/cms/commit/1abd40e4fcf1bb01f488447b9d6d392a14d961ac) -- there are some examples here: <https://github.com/craftcms/cms/issues/4847>
  
  
  ---
  
  