Edit Manual Order‑Level Discounts Directly During an Order Edit

Shopify’s 2027‑01 API now lets apps add, update, and remove manual order‑level discounts while editing an order, giving developers finer control and merchants a smoother discount workflow.

Edit Manual Order‑Level Discounts Directly During an Order Edit
6 sections

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!

}

  • valueType can be FIXED_AMOUNT or PERCENTAGE.
  • value follows the MoneyInput shape (amount and currencyCode).
  • 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

  • Upgrade the API version in your app’s GraphQL client to 2027‑01.
  • Add unit tests that cover adding, updating, and removing a manual discount, then committing the edit and verifying the final order total.
  • Check permission scopes – write_order_edits is required, and staff users need the “Apply discounts” permission.
  • Validate discount allocation – after staging, query CalculatedOrder.discountApplications and ensure the appliedTo field is ORDER and discountClass is null (manual discounts return null for this field).
  • Graceful fallback – if an app runs on an older API version, keep the previous flow (no order‑level discount editing) to avoid runtime errors.
  • 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.

    Tags
    Sources

    Related Articles

    New Shopify App Security Protections: What Developers and Merchants Must Do Now

    New Shopify App Security Protections: What Developers and Merchants Must Do Now

    Shopify’s latest app‑security updates introduce auto‑pausing of inactive custom apps, mandatory network‑access declarations, and expiring offline tokens. Learn who’s affected, what’s changing, and the exact steps you need to take before the Dec 8, 2026 and Jan 1, 2027 deadlines.

    December 3, 20265 min
    Secure WebSocket Support in allowed_sources: What Shopify Developers Need to Know

    Secure WebSocket Support in allowed_sources: What Shopify Developers Need to Know

    Shopify now lets apps declare secure WebSocket endpoints in shopify.app.toml. Learn what changed, who’s affected, and how to update your app configuration for seamless real‑time integrations.

    December 3, 20264 min
    Pull Your App’s Logs Directly in the Terminal with Shopify CLI 5.2

    Pull Your App’s Logs Directly in the Terminal with Shopify CLI 5.2

    Shopify CLI 5.2 adds a powerful shopify app logs command that lets developers and merchants fetch historical webhook, API, and Function logs right from their terminal. Learn what changed, who it affects, and how to start using it today.

    December 2, 20263 min
    marketUpdate Now Respects enabled:false: Drafting Markets with Conditions Made Explicit

    marketUpdate Now Respects enabled:false: Drafting Markets with Conditions Made Explicit

    Shopify’s Admin GraphQL API now treats enabled:false as a draft status for condition‑backed markets. Learn what changed, who’s affected, and how to update your apps to avoid silent failures.

    December 2, 20264 min