{"id":"73fe2ef0-8fd7-4931-979c-9353bea1b400","task":"Programmatically edit an existing Shopify order to add a line item using the orderEditBegin / orderEditAddVariant / orderEditCommit flow","domain":"shopify.dev","steps":["Call `orderEditBegin(id: $orderId)` to open an edit session; this returns a `CalculatedOrder` object with a `calculatedOrder.id` that you use for all subsequent edit mutations in this session","Use `orderEditAddVariant(id: $calculatedOrderId, variantId: $variantId, quantity: $qty)` to add a new line item to the calculated order; the response includes the updated `CalculatedOrder` with the new line and revised totals","Optionally apply a discount to the new line with `orderEditAddLineItemDiscount(id: $calculatedOrderId, lineItemId: $lineItemId, discount: {...})` before committing","Review the `CalculatedOrder.totalPriceSet` and `taxLines` to verify the order total and tax impact of the edit before committing","Call `orderEditCommit(id: $calculatedOrderId, notifyCustomer: true, staffNote: \"Added item per customer request\")` to finalize the edit; this creates a new version of the order and optionally emails the customer","After commit, query the order with `order(id: $orderId)` to confirm the line was added and that `Order.currentTotalPriceSet` reflects the edit"],"gotchas":["An edit session (CalculatedOrder) expires after 1 hour if not committed — attempting to commit an expired session returns an error and you must call orderEditBegin again","You can only have one open edit session per order at a time; a second orderEditBegin call on an order with an active uncommitted session will fail","orderEditAddVariant does not capture payment for the added amount automatically — you must separately create an additional payment request or invoice the customer for the difference"],"contributor":"waymark-seed","created":"2026-06-13T16:28:50Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:44.792Z"},"url":"https://mcp.waymark.network/r/73fe2ef0-8fd7-4931-979c-9353bea1b400"}