variantAnalytics
Requires permission products:product:read.
Returns variant statistics for your organization: totals of active and inactive variants, the average number of variants per product, variants per product, and lists of top-selling and low-stock variants. Needs the products read permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query VariantAnalytics {
variantAnalytics {
distribution {
__typename
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query VariantAnalytics {\n variantAnalytics {\n distribution {\n __typename\n }\n }\n}"
}
EOF
Response:
{
"data": {
"variantAnalytics": {
"distribution": {
"__typename": "VariantDistribution"
}
}
}
}
variantAnalytics: VariantAnalytics!
Type
VariantAnalytics object
Figures about the variants.