Skip to main content

createDiscountScheme

Requires permission products:discount:create.

Creates a discount scheme with its rules and validity window. The discount type, a percentage or a fixed amount, comes from the first discount rule. Needs the discounts create 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:

mutation CreateDiscountScheme($data: CreateDiscountSchemeDto!) {
createDiscountScheme(data: $data) {
id
code
name
type
createdAt
applicableCustomerTypes
partners {
id
createdAt
discountSchemeId
partnerId
updatedAt
}
}
}

Variables:

{
"data": {
"discountRules": [
{
"discountType": "FIXED_AMOUNT",
"discountValue": 0,
"name": "string"
}
],
"name": "string",
"validFrom": "string"
}
}

Response:

{
"data": {
"createDiscountScheme": {
"id": "id",
"code": "string",
"name": "string",
"type": "BUY_X_GET_Y",
"createdAt": "2025-01-15T00:00:00Z",
"applicableCustomerTypes": "string",
"partners": [
{
"id": "id",
"createdAt": "2025-01-15T00:00:00Z",
"discountSchemeId": "string",
"partnerId": "string",
"updatedAt": "2025-01-15T00:00:00Z"
}
]
}
}
}
createDiscountScheme(
data: CreateDiscountSchemeDto!
): DiscountScheme!

Arguments​

createDiscountScheme.data ● CreateDiscountSchemeDto! non-null input​

The scheme's name, optional code, scope, currency, validity dates, usage limits, discount rules, and applicable customer types and regions.

Type​

DiscountScheme object​

A discount scheme.