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 query would return the first 50 products, so using "first" argument is necessary.

Please remember that 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
    options {
      code
      name {
        value
        language
      }
    }
  }
  variantList {
    ... ProductConnection
  }
}

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

fragment Attribute on Attribute {
  code
  name {
    value
    language
  }
  scope
}

fragment Product on Product {
  __typename
  sku
  createdAt
  editedAt
}

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

Last updated