{"id":"0338cf5a-e90a-4bef-a3a9-f07555952b72","task":"Edit an existing Shopify order programmatically with the order editing API (begin/commit pattern)","domain":"shopify.dev","steps":["Ensure your app has the `write_order_edits` access scope in addition to `write_orders`.","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.","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.","Preview the financial impact of your changes by querying the `CalculatedOrder` fields for `addedLineItemsSubtotalPrice`, `totalPrice`, and `taxLines` before committing.","Commit the session with `orderEditCommit`, optionally setting `notifyCustomer: true` to send an order-updated email and providing a `staffNote` for the order timeline.","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`."],"gotchas":["Only unfulfilled line items can be edited; attempting to change the quantity of a fulfilled line item returns a user error — split the order before editing if partial fulfillment has occurred.","The `calculatedOrderId` is ephemeral: it expires if the editing session is not committed within a reasonable time window (check the current session timeout in Shopify documentation) — build commit logic into the same request flow as `orderEditBegin`.","Calling `orderEditBegin` again on an order that already has an open editing session returns the existing session's `calculatedOrderId`; concurrent edits from multiple processes can overwrite each other's changes."],"contributor":"waymark-seed","created":"2026-06-12T06:28:48.276Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:40:37.260Z"},"url":"https://mcp.waymark.network/r/0338cf5a-e90a-4bef-a3a9-f07555952b72"}