See the Queries page for a presentation of this resource.
Create a discount rule
GraphQL
mutation CreateDiscountRule($input: DiscountRuleInput!) {
CreateDiscountRule(input: $input) {
id
label
active
target
started_at
ended_at
start_date_condition
end_date_condition
intervals { id interval_start_type interval_start_value discount_type discount_value }
}
}
JSON
{
"input": {
"label": "Summer Sale 2025",
"active": true,
"target": "product",
"start_date_condition": "2025-06-01",
"end_date_condition": "2025-08-31",
"intervals": [
{
"interval_start_type": "amount",
"interval_start_value": 100,
"discount_type": "percentage",
"discount_value": 10
},
{
"interval_start_type": "amount",
"interval_start_value": 500,
"discount_type": "percentage",
"discount_value": 15
}
]
}
}
JSON
{
"data": {
"CreateDiscountRule": {
"id": 100003,
"label": "Summer Sale 2025",
"active": true,
"target": "product",
"started_at": null,
"ended_at": null,
"start_date_condition": "2025-06-01",
"end_date_condition": "2025-08-31",
"intervals": [
{
"id": 2001,
"interval_start_type": "amount",
"interval_start_value": 100,
"discount_type": "percentage",
"discount_value": 10
},
{
"id": 2002,
"interval_start_type": "amount",
"interval_start_value": 500,
"discount_type": "percentage",
"discount_value": 15
}
]
}
}
}
Update a discount rule
id - ID Id of the discount rule
GraphQL
mutation UpdateDiscountRule($id: ID!, $input: DiscountRuleInput!) {
UpdateDiscountRule(id: $id, input: $input) {
id
label
active
target
started_at
ended_at
start_date_condition
end_date_condition
}
}
JSON
{
"id": 100003,
"input": {
"label": "Summer Sale Extended 2025",
"end_date_condition": "2025-09-30"
}
}
JSON
{
"data": {
"UpdateDiscountRule": {
"id": 100003,
"label": "Summer Sale Extended 2025",
"active": true,
"target": "product",
"started_at": null,
"ended_at": null,
"start_date_condition": "2025-06-01",
"end_date_condition": "2025-09-30"
}
}
}
Delete a discount rule
id - ID Id of the discount rule
GraphQL
mutation DeleteDiscountRule($id: ID!) {
DeleteDiscountRule(id: $id)
}
JSON
{
"data": { "DeleteDiscountRule": true }
}
Disable a discount rule
id - ID Id of the discount rule
GraphQL
mutation DisableDiscountRule($id: ID!) {
DisableDiscountRule(id: $id) {
id
label
active
}
}
JSON
{
"data": {
"DisableDiscountRule": {
"id": 100003,
"label": "Summer Sale Extended 2025",
"active": false
}
}
}
Enable a discount rule
id - ID Id of the discount rule
GraphQL
mutation EnableDiscountRule($id: ID!) {
EnableDiscountRule(id: $id) {
id
label
active
}
}
JSON
{
"data": {
"EnableDiscountRule": {
"id": 100003,
"label": "Summer Sale Extended 2025",
"active": true
}
}
}
id - Int Identifier (optional)
label - String Label of the discount rule
active - Boolean Whether the discount rule is active
target - Target Target of the discount rule (document, product, shipping_cost)
start_date_condition - Date Start date condition for the discount
end_date_condition - Date End date condition for the discount
product_tags_condition - [ProductTagInput] Product tags that must match for the discount
customer_tags_condition - [CustomerTagInput] Customer tags that must match for the discount
supplier_tags_condition - [SupplierTagInput] Supplier tags that must match for the discount
seasons_condition - [SeasonInput] Seasons that must match for the discount
suppliers_condition - [SupplierInput] Suppliers that must match for the discount
id - Int Identifier (optional)
interval_start_value - Float Value for the interval start
discount_type - DiscountType Type of discount (amount, percentage)
discount_value - Float Value of the discount
Value Description documentDiscount applies to the entire document. productDiscount applies to specific products. shipping_costDiscount applies to shipping costs.
Value Description salesRule applies to sales documents only. purchasesRule applies to purchase documents only. bothRule applies to both sales and purchases.
Value Description amountInterval starts at a specific monetary amount. quantityInterval starts at a specific quantity.
Value Description amountFixed discount amount. percentagePercentage-based discount.