2

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)
      }
    }
  }
}
1

Try using _count -- there are some examples here: https://github.com/craftcms/cms/issues/4847

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.