0

I have a shop with several products and each product have his own attributes. I'm trying to get those attribute values of each product with GraphQL but I don't know what are the attributes. I want to make a query that returns all the products and each product have his attributes specified. Is there a way to make that?

0

Whilst listing the attributes for a given attribute set is obviously important, I had to use a Rest API call to gather the attributes.

I advise to run a Rest API (http://magento-root/index.php/rest/V1/products/attribute-sets/attributeSetId/attributes) to gather your attributes.. You might want to do this when your system loads and then cache it?

then, a query like the below will give you the products data with the attributes relevant to your attribute set.

http://magento-root/index.php/graphql

{
  products(
    filter: { sku: { eq: "24-WB01" } }
  ) {
    items {
      name
      sku
      color
      description {
        html
      }
      sleeve
      attribute_set_id

    }
  }
}
| improve this answer | |

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.