draftOrder
Returns a DraftOrder resource by ID.
Anchor to Possible returnsPossible returns
- Anchor to DraftOrderDraft•
Order An order that a merchant creates on behalf of a customer. Draft orders are useful for merchants that need to do the following tasks:
- Create new orders for sales made by phone, in person, by chat, or elsewhere. When a merchant accepts payment for a draft order, an order is created.
- Send invoices to customers to pay with a secure checkout link.
- Use custom items to represent additional costs or products that aren't displayed in a shop's inventory.
- Re-create orders manually from active sales channels.
- Sell products at discount or wholesale rates.
- Take pre-orders.
- Save an order as a draft and resume working on it later.
For draft orders in multiple currencies
is the source of truth for what a customer is going to be charged and
is an estimate of what the merchant might receive in their shop currency.
Caution: Only use this data if it's required for your app's functionality. Shopify will restrict access to scopes for apps that don't have a legitimate use for the associated data.
Draft orders created on or after April 1, 2025 will be automatically purged after one year of inactivity.
- Get a draft order by ID
- Get a list of draft orders by ID and GraphQL alias
- Get a list of line item names for a draft order
- Get a metafield attached to a draft order
- Get metafields attached to a draft order
- Receive a single DraftOrder
Examples
query {
draftOrder(id: "gid://shopify/DraftOrder/276395349") {
name
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { draftOrder(id: \"gid://shopify/DraftOrder/276395349\") { name } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
draftOrder(id: "gid://shopify/DraftOrder/276395349") {
name
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
draftOrder(id: "gid://shopify/DraftOrder/276395349") {
name
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
draftOrder(id: "gid://shopify/DraftOrder/276395349") {
name
}
}
QUERY
response = client.query(query: query)