Skip to main content

Manual Discounts

Introduction

Manual discounts can be applied by staff users to orders with DRAFT or UNCONFIRMED status. The discount can be applied to the order to decrease its subtotal and shipping price (manual order discount), or to the order line to reduce its unit price (manual line discount). These discounts are not combined with other discounts associated with the same object (order or line). Manual discount takes precedence and overrides any existing ones.

Manual line discount

The manual line discount can be applied with orderLineDiscountUpdate mutation. This discount reduces the unit price of the order line. The calculation is based on the undiscounted unit price, which means that any other unit price reductions, such as catalogue promotions or specific product vouchers, will be overridden. If the discount exceeds undiscounted unit price, it is set to 0 and don't have an impact on other lines.

Example

We have draft order with total price of $150, of which:

  • line 1 with quantity 2, unit price $50 and total $100
  • line 2 with quantity 1, unit price $30 and total $30
  • shipping price $20

Let's apply 20% manual line discount to the line 1:

Request:

mutation OrderLineDiscountUpdate($orderLineId: ID!, $input: OrderDiscountCommonInput!) {
orderLineDiscountUpdate(orderLineId: $orderLineId, input: $input) {
order {
id
undiscountedTotal{
net{
amount
}
}
total{
net{
amount
}
}
shippingPrice{
net{
amount
}
}
lines{
undiscountedTotalPrice{
net{
amount
}
}
totalPrice{
net{
amount
}
}
undiscountedUnitPrice{
net{
amount
}
}
unitPrice{
net{
amount
}
}
unitDiscount {
amount
}
}
}
}
}
Expand ▼
{
"orderLineId": "T3JkZXJMaW5lOmFlYTBmNjMzLWU0MTItNDkwZS1hODhhLThlMTg3YzQ3N2ZkNQ==",
"input": {
"valueType": "PERCENTAGE",
"value": 20,
"reason": "staff line discount"
}
}

Response:

{
"data": {
"orderLineDiscountUpdate": {
"order": {
"id": "T3JkZXI6MTRjODlkMDUtYjg4Ny00YzQ1LWI1MDUtYmZlZDVmZmY0ZTQz",
"undiscountedTotal": {
"net": {
"amount": 150.0
}
},
"total": {
"net": {
"amount": 130.0
}
},
"shippingPrice": {
"net": {
"amount": 20.0
}
},
"lines": [
{
"id": "T3JkZXJMaW5lOmFlYTBmNjMzLWU0MTItNDkwZS1hODhhLThlMTg3YzQ3N2ZkNQ==",
"quantity": 2,
"undiscountedTotalPrice": {
"net": {
"amount": 100.0
}
},
"totalPrice": {
"net": {
"amount": 80.0
}
},
"undiscountedUnitPrice": {
"net": {
"amount": 50.0
}
},
"unitPrice": {
"net": {
"amount": 40.0
}
},
"unitDiscount": {
"amount": 10.0
}
},
{
"id": "T3JkZXJMaW5lOmU3ZWY1YjY4LTUzYmMtNGIyOC1iMmU2LWI0YjI3OWE0NTg2OA==",
"quantity": 1,
"undiscountedTotalPrice": {
"net": {
"amount": 30.0
}
},
"totalPrice": {
"net": {
"amount": 30.0
}
},
"undiscountedUnitPrice": {
"net": {
"amount": 30.0
}
},
"unitPrice": {
"net": {
"amount": 30.0
}
},
"unitDiscount": {
"amount": 0.0
}
}
]
}
}
}
}
Expand ▼

As a result, the discount reduced line 1 unit price from 50$ to 40$.

For more complex cases, please check Examples section.

Manual order discount

The manual order discount can be applied with orderDiscountAdd mutation. It impacts both the subtotal and shipping price. If the fixed value is provided, Saleor proportionally computes the subtotal and shipping portion. When the order qualifies for an order promotion or has an entire order voucher applied, the manual order discount takes precedence and overrides them. It's important to note that the discount is calculated based on base subtotal and base shipping prices, meaning line-level discounts are not overridden.

Example

We have draft order with total price of $150, of which:

  • line 1 with quantity 2, unit price $50 and total $100
  • line 2 with quantity 1, unit price $30 and total $30
  • shipping price $20

Let's apply $15 manual order discount to the order:

Request:

mutation OrderDiscountAdd($id: ID!, $input: OrderDiscountCommonInput!) {
orderDiscountAdd(orderId: $id, input: $input) {
order {
id
undiscountedTotal{
net{
amount
}
}
total{
net{
amount
}
}
subtotal {
net{
amount
}
}
undiscountedShippingPrice{
amount
}
shippingPrice{
net{
amount
}
}
lines{
undiscountedTotalPrice{
net{
amount
}
}
totalPrice{
net{
amount
}
}
undiscountedUnitPrice{
net{
amount
}
}
unitPrice{
net{
amount
}
}
unitDiscount {
amount
}
}
}
}
}
Expand ▼
{
"id": "T3JkZXI6NDhkYWNmYTMtZmE1Mi00N2FiLTk0ZGUtODE5NjFmNjllNzBi",
"input": {
"valueType": "FIXED",
"value": 15,
"reason": "staff order discount"
}
}

Response:

{
"data": {
"orderDiscountAdd": {
"errors": [],
"order": {
"id": "T3JkZXI6NDhkYWNmYTMtZmE1Mi00N2FiLTk0ZGUtODE5NjFmNjllNzBi",
"undiscountedTotal": {
"net": {
"amount": 150.0
}
},
"total": {
"net": {
"amount": 135.0
}
},
"subtotal": {
"net": {
"amount": 117.0
}
},
"shippingPrice": {
"net": {
"amount": 18.0
}
},
"lines": [
{
"undiscountedTotalPrice": {
"net": {
"amount": 100.0
}
},
"totalPrice": {
"net": {
"amount": 90.0
}
},
"undiscountedUnitPrice": {
"net": {
"amount": 50.0
}
},
"unitPrice": {
"net": {
"amount": 45.0
}
},
"unitDiscount": {
"amount": 0.0
}
},
{
"undiscountedTotalPrice": {
"net": {
"amount": 30.0
}
},
"totalPrice": {
"net": {
"amount": 27.0
}
},
"undiscountedUnitPrice": {
"net": {
"amount": 30.0
}
},
"unitPrice": {
"net": {
"amount": 27.0
}
},
"unitDiscount": {
"amount": 0.0
}
}
]
}
}
}
}
Expand ▼

As a result the order's total was reduced by $15. Since base shipping price accounts for 13.33% ($20 / $150) of base total, the shipping price was reduced by $2 (20 / 150 * 15). The rest of the discount, $13 was applied to the subtotal and next propagated to the line prices. Since the first line accounts for 77% ($100 / $130) of subtotal, its price was discounted by $10 (100 / 130 * 13).

For more complex cases, please check Examples section.

Manual discounts with vouchers

Manual discounts take precedence over vouchers, overriding them when applied. However, this does not entirely dissociate the voucher from the order. For example, if the manual discount is removed, the system reevaluates the voucher code associated with the order. Note that if the voucher has a usage limit and is overridden by a manual discount, the usage count for the voucher remains unaffected.