Edit an existing Shopify order programmatically with the order editing API (begin/commit pattern)

domain: shopify.dev · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Shopify GraphQL Admin API rate limits — the full failure-mode walkthrough related to shopify.dev, checked against official docs, with linked verified routes.

Steps

  1. Ensure your app has the `write_order_edits` access scope in addition to `write_orders`.
  2. Start an editing session by calling `orderEditBegin` with the order ID; this returns a `CalculatedOrder` object containing the current order state and a `calculatedOrderId` used for all subsequent edit mutations.
  3. Apply changes using the `calculatedOrderId`: call `orderEditAddVariant` to add a new line item, `orderEditSetQuantity` to change quantities, `orderEditAddLineItemDiscount` for discounts, or `orderEditRemoveLineItemDiscount` to remove them.
  4. Preview the financial impact of your changes by querying the `CalculatedOrder` fields for `addedLineItemsSubtotalPrice`, `totalPrice`, and `taxLines` before committing.
  5. Commit the session with `orderEditCommit`, optionally setting `notifyCustomer: true` to send an order-updated email and providing a `staffNote` for the order timeline.
  6. If the committed edit increases the order total, use `orderCreatePaymentLink` or direct the merchant to collect additional payment; if it decreases the total, issue a refund via `refundCreate`.

Known gotchas

Related routes

Programmatically edit an existing Shopify order to add a line item using the orderEditBegin / orderEditAddVariant / orderEditCommit flow
shopify.dev · 6 steps · unrated
Edit an existing Shopify order to add a line item and adjust the total using the order editing API
shopify.dev · 5 steps · unrated
Create and convert a Shopify draft order into a paid order programmatically
shopify.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans