Order Discounts
Discounts are static monetary adjustments on an order. They represent fixed deductions — either a flat amount or a percentage — applied to the order total, individual order lines, or shipping fees.
TIP
For dynamic, component-based pricing logic that re-evaluates as orders change, see Promotions.
Discount Types
Absolute
A fixed monetary amount deducted from the target. The value is treated as including or excluding tax based on the order's taxIncluded setting.
{
"type": "createStaticOrderDiscount",
"value": 50,
"description": "Loyalty reward"
}Percentage
A proportional deduction expressed as a factor. For example, 0.1 means 10% off.
{
"type": "createStaticOrderDiscount",
"isPercentage": true,
"value": 0.1,
"description": "10% staff discount"
}Discount Scopes
Static discounts can target different parts of an order:
Order Discount
Distributed proportionally across all order lines and shipping fees. Created with createStaticOrderDiscount.
Order Line Discount
Applied to a specific order line. Created with createStaticOrderLineDiscount.
Shipping Discount
Applied to a delivery's shipping fee. Created with createStaticShippingDiscount.
Managing Discounts
Creating
Use the appropriate command for the scope you need:
[{
"type": "applyCommands",
"body": {
"commands": [{
"type": "createStaticOrderDiscount",
"value": 50,
"description": "Coupon ABC123"
}]
}
}]An optional discountId can be provided. If omitted, one is generated automatically.
Updating
Change the value of an existing static discount with setStaticDiscountValue:
{
"type": "setStaticDiscountValue",
"discountId": "65812410-bd14-4d6d-ab79-374789a976c1",
"value": 75
}Metadata
setDiscountDescription— update the customer-facing descriptionsetDiscountDynamicFields— store custom metadata
Deleting
Remove a discount with deleteDiscount:
{
"type": "deleteDiscount",
"discountId": "65812410-bd14-4d6d-ab79-374789a976c1"
}Calculated Discounts
When a discount is applied, the system calculates the actual monetary impact and distributes it across order lines and shipping as CalculatedDiscounts. These represent the resolved per-line or per-shipping amounts in the order's currency.
You can query calculated discounts through the Graph:
discount— the discount entity itselfcalculatedDiscount— the resolved amounts per order line / shipping
See Also
- Promotions — dynamic, component-based discount logic
- Order Commands — full command reference
- Order Actor — order actor overview