Anchor to section titled 'undefined'

orderEditAddLineItemDiscount
mutation

Requires write_order_edits 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.


The discount to add to the line item.

Anchor to id
id
required

The ID of the calculated order to update.

Anchor to lineItemId
lineItemId
required

The ID of the calculated line item to add the discount to.


Was this section helpful?

The discount applied to a line item during this order edit.

The line item with the edits applied but not saved.

An order with the edits applied but not saved.

The list of errors that occurred from executing the mutation.


Was this section helpful?
Hide code
Mutation reference
Copy
mutation orderEditAddLineItemDiscount($discount: OrderEditAppliedDiscountInput!, $id: ID!, $lineItemId: ID!) {
  orderEditAddLineItemDiscount(discount: $discount, id: $id, lineItemId: $lineItemId) {
    addedDiscountStagedChange {
      # OrderStagedChangeAddLineItemDiscount fields
    }
    calculatedLineItem {
      # CalculatedLineItem fields
    }
    calculatedOrder {
      # CalculatedOrder fields
    }
    userErrors {
      field
      message
    }
  }
}
Hide code
Input
Copy
{
  "discount": {
    "description": "<your-description>",
    "fixedValue": {
      "amount": "29.99",
      "currencyCode": "AED"
    },
    "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!
}