Anchor to orderEditAddLineItemDiscountorder
orderEditAddLineItemDiscount
mutation
Requires access scope. Also: The user must have apply_discounts_to_orders permission.
Adds a discount to a line item on the current order edit. For more information on how to use the GraphQL Admin API to edit an existing order, refer to Edit existing orders.
Anchor to Arguments
Arguments
- Anchor to discountdiscount•Order
Edit requiredApplied Discount Input! The discount to add to the line item.
- •ID!required
The ID of the calculated order to update.
- Anchor to lineItemIdline•
Item Id ID!required The ID of the calculated line item to add the discount to.
Was this section helpful?
Anchor to OrderEditAddLineItemDiscountPayload returnsOrderEditAddLineItemDiscountPayload returns
- Anchor to addedDiscountStagedChangeadded•
Discount Staged Change The discount applied to a line item during this order edit.
- Anchor to calculatedLineItemcalculated•
Line Item The line item with the edits applied but not saved.
- Anchor to calculatedOrdercalculated•
Order An order with the edits applied but not saved.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
Mutation Reference
1mutation orderEditAddLineItemDiscount($discount: OrderEditAppliedDiscountInput!, $id: ID!, $lineItemId: ID!) {2 orderEditAddLineItemDiscount(discount: $discount, id: $id, lineItemId: $lineItemId) {3 addedDiscountStagedChange {4 # OrderStagedChangeAddLineItemDiscount fields5 }6 calculatedLineItem {7 # CalculatedLineItem fields8 }9 calculatedOrder {10 # CalculatedOrder fields11 }12 userErrors {13 field14 message15 }16 }17}
Input
1{2 "discount": {3 "description": "<your-description>",4 "fixedValue": {5 "amount": "29.99",6 "currencyCode": ""7 },8 "percentValue": 1.19 },10 "id": "gid://shopify/<objectName>/10079785100",11 "lineItemId": "gid://shopify/<objectName>/10079785100"12}
{
"discount": {
"description": "<your-description>",
"fixedValue": {
"amount": "29.99",
"currencyCode": ""
},
"percentValue": 1.1
},
"id": "gid://shopify/<objectName>/10079785100",
"lineItemId": "gid://shopify/<objectName>/10079785100"
}
input OrderEditAppliedDiscountInput {
description: String
fixedValue: MoneyInput
percentValue: Float
}
input MoneyInput {
amount: Decimal!
currencyCode: CurrencyCode!
}