On the frontend side of my app, I want to get the review counts, and the average rating of the product. How can I get it? I already have the storefront API key and I think this is needed for what I need. But I was unable to get it to work.
Here is my query:
const query = `
{
product(handle: "my-product-handle") {
title
description
priceRange {
minVariantPrice {
amount
currencyCode
}
}
rating: metafield(namespace: "custom", key: "rating") {
value
type
}
}
}
`;
Here, everything works but the rating returns null. I was working on this for days, so any kind of help is appreciated