CreateDiscountRule
Create a discount rule
Parameters
| input - DiscountRuleInput |
|---|
| Data of the discount rule |
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 }
}
}{
"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
}
]
}
}{
"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
}
]
}
}
}UpdateDiscountRule
Update a discount rule
Parameters
| id - ID |
|---|
| Id of the discount rule |
| input - DiscountRuleInput |
|---|
| Data of the discount rule |
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
}
}{
"id": 100003,
"input": {
"label": "Summer Sale Extended 2025",
"end_date_condition": "2025-09-30"
}
}{
"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"
}
}
}DeleteDiscountRule
Delete a discount rule
Parameters
| id - ID |
|---|
| Id of the discount rule |
mutation DeleteDiscountRule($id: ID!) {
DeleteDiscountRule(id: $id)
}{
"id": 100003
}{
"data": { "DeleteDiscountRule": true }
}DisableDiscountRule
Disable a discount rule
Parameters
| id - ID |
|---|
| Id of the discount rule |
mutation DisableDiscountRule($id: ID!) {
DisableDiscountRule(id: $id) {
id
label
active
}
}{
"id": 100003
}{
"data": {
"DisableDiscountRule": {
"id": 100003,
"label": "Summer Sale Extended 2025",
"active": false
}
}
}EnableDiscountRule
Enable a discount rule
Parameters
| id - ID |
|---|
| Id of the discount rule |
mutation EnableDiscountRule($id: ID!) {
EnableDiscountRule(id: $id) {
id
label
active
}
}{
"id": 100003
}{
"data": {
"EnableDiscountRule": {
"id": 100003,
"label": "Summer Sale Extended 2025",
"active": true
}
}
}DiscountRuleInput data type
| 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) |
| scope - DiscountRuleScope |
|---|
| Scope of the discount rule |
| start_date_condition - Date |
|---|
| Start date condition for the discount |
| end_date_condition - Date |
|---|
| End date condition for the discount |
| intervals - [DiscountRuleIntervalInput] |
|---|
| Discount intervals for the rule |
| 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 |
DiscountRuleIntervalInput data type
| id - Int |
|---|
| Identifier (optional) |
| interval_start_type - IntervalStartType |
|---|
| Type of interval start (amount, quantity) |
| interval_start_value - Float |
|---|
| Value for the interval start |
| discount_type - DiscountType |
|---|
| Type of discount (amount, percentage) |
| discount_value - Float |
|---|
| Value of the discount |
Enums
IntervalStartType
IntervalStartType| Value | Description |
|---|---|
amount | Interval starts at a specific monetary amount. |
quantity | Interval starts at a specific quantity. |
DiscountType
DiscountType| Value | Description |
|---|---|
amount | Fixed discount amount. |
percentage | Percentage-based discount. |
