Create a Shopify draft order and apply a custom line item discount before converting to a paid order

domain: shopify.dev · 5 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. Call draftOrderCreate mutation with lineItems array including variantId, quantity, and an optional appliedDiscount at the line level specifying valueType (PERCENTAGE or FIXED_AMOUNT) and value
  2. Add a customAttributes array for any order-level metadata needed by downstream systems
  3. Optionally apply an order-level discount via the draftOrderApplyDiscount mutation or include it in the initial create call
  4. Send the invoice to the customer via draftOrderInvoiceSend or complete the draft order directly via draftOrderComplete with paymentPending set to false for manual payment
  5. After payment is captured outside Shopify or via a payment link, call draftOrderComplete to convert it to a finalized order

Known gotchas

Related routes

Create and convert a Shopify draft order into a paid order programmatically
shopify.com · 6 steps · unrated
Programmatically edit an existing Shopify order to add a line item using the orderEditBegin / orderEditAddVariant / orderEditCommit flow
shopify.dev · 6 steps · unrated
Create and deploy a Shopify Function for custom discount logic (order-level percentage off above a spend threshold) using the Discount API surface
shopify.dev · 5 steps · unrated

Give your agent this knowledge — and 15,600+ 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