Create and place a draft order

Outcome: an editable draft order is created in the prepared store context, reviewed, and placed as an order.

Prerequisites

Use an Admin credential and a prepared store, currency, price channel, shipping/tax configuration, and optional customer. Decide whether each line is a catalog item or a genuine custom line.

1. Create the draft

Code in graphql

Pass storeId, currency, optional priceChannelId, customer/email, and addresses. Retain the returned draft ID.

2. Add and adjust lines

Use draftOrderLineItemsAdd for catalog variants so Thor resolves catalog pricing. Use draftOrderCustomLineItemsAdd only for items outside the catalog. Supported mutations can set or reset a catalog line’s price, apply a manual discount, add codes, and select a returned shipping method or custom shipping line.

After each change, inspect the returned line, discount, tax, shipping, and total fields. A price override remains an explicit administrative decision; record its business reason outside the amount when operations require an audit trail.

3. Place and verify

Code in graphql

Pass the draft ID using the exact input contract. Persist the resulting order ID, then query the order before payment or fulfillment. If the draft should not become an order, use draftOrderDiscard instead. See Draft orders.