Shopify just rolled out a powerful addition to the GraphQL Admin API in version 2027‑01: you can now edit manual order‑level discounts while performing an order edit. This change closes a long‑standing gap that forced merchants to apply discounts outside the edit flow, and gives developers a new set of mutations to manage discounts programmatically.
Why it matters – manual discounts are common for promotions, price adjustments, or refunds. Previously you could only stage line‑item discounts during an edit; order‑level discounts had to be applied after the edit was committed, which added friction and risk of mismatched totals.
What Changed
Starting in API version 2027‑01, three new mutations were introduced: orderEditAddManualOrderDiscount, orderEditUpdateDiscount, and orderEditRemoveDiscount. They let you stage a fixed‑amount or percentage discount on the entire order, update an existing manual discount, or remove it entirely before you commit the edit with orderEditCommit. The discount is automatically allocated across all line items, and you can query the new CalculatedOrder.discountApplications field to see the staged discounts in real time.
Who Is Affected
The change only impacts apps that edit orders and that target API version 2027‑01 or later. Your app must have the write_order_edits scope, and any staff member using the app must have permission to apply discounts to orders. Merchants who rely on custom order‑editing tools will see the new capability reflected in the UI once the app is updated.
How to Implement the New Mutations
Below is a minimal GraphQL example for adding a 10 % manual discount to an order edit. Replace $orderEditId with the edit ID you obtained from orderEditCreate, and adjust the amount or percentage fields as needed.
graphql
mutation orderEditAddManualOrderDiscount($orderEditId: ID!, $discount: ManualDiscountInput!) {
orderEditAddManualOrderDiscount(id: $orderEditId, discount: $discount) {
userErrors { field message }
orderEdit { id }
}
}
The ManualDiscountInput type looks like this:
graphql
input ManualDiscountInput {
title: String!
value: MoneyInput!
valueType: DiscountValueType!
}
Updating or removing follows the same pattern using orderEditUpdateDiscount or orderEditRemoveDiscount, passing the discount’s discountApplicationId returned from the add mutation.
Handling the New Union Type
When you query staged changes, the response now includes a new member on the OrderStagedChange union: OrderStagedChangeAddManualDiscount. If your code switches on __typename to process staged changes, add a case for this new type so you can log, display, or react to manual order‑level discounts exactly as you do for line‑item changes.
js
switch(change.__typename) {
case 'OrderStagedChangeAddLineItem':
// existing logic
break;
case 'OrderStagedChangeAddManualDiscount':
console.log('Manual order discount staged:', change);
break;
// other cases …
}
Testing and Best Practices
Next Steps
Update your app’s manifest to target API version 2027‑01, replace any hard‑coded discount logic with the new mutations, and run a full regression test in a development store. Once verified, push the changes to production and let your merchant users know they can now adjust order‑level discounts without leaving the order‑edit screen. Need help or have questions? Drop a comment below or reach out on the Shopify Community forums.
