Skip to main content

discountUsageStats

Requires permission products:discount:read.

Returns how much a discount scheme has been used, taken from the organization's sales orders. Cancelled and deleted orders are left out. Fails if the scheme does not exist. Needs the discounts 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:

query DiscountUsageStats($schemeId: String!) {
discountUsageStats(schemeId: $schemeId) {
averageDiscountPerOrder
totalDiscountAmount
totalUsage
uniqueCustomers
}
}

Variables:

{
"schemeId": "string"
}

Response:

{
"data": {
"discountUsageStats": {
"averageDiscountPerOrder": 0,
"totalDiscountAmount": 0,
"totalUsage": 0,
"uniqueCustomers": 0
}
}
}
discountUsageStats(
schemeId: String!
): DiscountUsageStats!

Arguments​

discountUsageStats.schemeId ● String! non-null scalar​

The ID of the discount scheme.

Type​

DiscountUsageStats object​

How a discount scheme has been used.