List of 100 grouped products with simple and variable products in stream

This will allow you to get list of first 100 product no matter if they're simple or variable.

By default, the query would return the first 50 products if no "first" argument is used.

Please remember that the limit for "first" is 200

query groupingProduct {
  productStream(first: 100) {
    ...ProductConnection
    edges {
      node {
        ... on GroupingProduct {
          ...Product
          childrenList {
            pageInfo {
              hasNextPage
              endCursor
            }
            edges {
              node {
                quantity
                product {
                  ...SimpleProduct
                  ...VariableProduct
                }
              }
            }
          }
        }
        template {
          code
        }
      }
    }
  }
}

fragment SimpleProduct on SimpleProduct {
  ...Product
  attributeList {
    ...AttributeValueConnection
  }
}

fragment VariableProduct on VariableProduct {
  ...Product
  attributeList {
    ...AttributeValueConnection
  }
  bindings {
    ...Attribute
    optionList(first: 10, after: "") {
      edges {
        node {
          code
          customFields {
            customField {
              code
            }
          }
          name(languages: ["en_US"]) {
            value
            language
          }
        }
      }
    }
  }
  variantList {
    ...ProductConnection
  }
}

fragment AttributeValueConnection on AttributeValueConnection {
  pageInfo {
    hasNextPage
    endCursor
  }
  edges {
    node {
      attribute {
        ...Attribute
      }
      translations {
        language
      }
    }
  }
}

fragment Attribute on Attribute {
  code
  name(languages: ["en_US"]) {
    value
    language
  }
  scope
}

fragment Product on Product {
  __typename
  sku
  createdAt
  editedAt
}

fragment ProductConnection on ProductConnection {
  pageInfo {
    hasNextPage
    endCursor
  }
  edges {
    node {
      ...Product
    }
  }
}

Last updated

Was this helpful?