draft Orderquery
Returns a DraftOrder resource by ID.
Arguments
The ID of the DraftOrder to return.
DraftOrder possible returns
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
presentment
is the source of truth for what a customer is going to be charged and_money shop
is an estimate of what the merchant might receive in their shop currency._money 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.
Code examples for QUERY: draftOrder
Query Reference for QUERY: draftOrder
"{\n draftOrder(id) {\n # DraftOrder fields\n }\n}"
Input Reference for QUERY: draftOrder
Schema Reference for QUERY: draftOrder
Display Examples for QUERY: draftOrder
[ { "example": { "type_name": "draftorder", "title": "Get a draft order by ID", "description": "The following query retrieves a draft order by ID and returns the draft order name.", "query_string": "query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n}", "query_arguments": { "id": "gid://shopify/DraftOrder/276395349" }, "response": { "data": { "draftOrder": { "name": "#D1" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/draft_orders/test/unit/graph_api/admin/draft_order_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { draftOrder(id: \\\"gid://shopify/DraftOrder/276395349\\\") { name } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n }`,\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the DraftOrder to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/DraftOrder/276395349\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "draftorder", "title": "Get a list of draft orders by ID and GraphQL alias", "description": "The following query retrieves a list of draft orders by ID and GraphQL alias and returns the name for each draft order.", "query_string": "query {\n draftOrder1: draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n draftOrder2: draftOrder(id: \"gid://shopify/DraftOrder/221448317\") {\n name\n }\n}", "query_arguments": { "id": "gid://shopify/DraftOrder/276395349" }, "response": { "data": { "draftOrder1": { "name": "#D1" }, "draftOrder2": { "name": "#D7" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/draft_orders/test/unit/graph_api/admin/draft_order_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { draftOrder1: draftOrder(id: \\\"gid://shopify/DraftOrder/276395349\\\") { name } draftOrder2: draftOrder(id: \\\"gid://shopify/DraftOrder/221448317\\\") { name } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n draftOrder1: draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n draftOrder2: draftOrder(id: \"gid://shopify/DraftOrder/221448317\") {\n name\n }\n }`,\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n draftOrder1: draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n draftOrder2: draftOrder(id: \"gid://shopify/DraftOrder/221448317\") {\n name\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n draftOrder1: draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n draftOrder2: draftOrder(id: \"gid://shopify/DraftOrder/221448317\") {\n name\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n draftOrder1: draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n draftOrder2: draftOrder(id: \"gid://shopify/DraftOrder/221448317\") {\n name\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the DraftOrder to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/DraftOrder/276395349\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "draftorder", "title": "Get a list of line item names for a draft order", "description": "The following query retrieves the first 5 line items for a draft order and returns the name of each line item.", "query_string": "query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n lineItems(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n }\n}", "query_arguments": { "id": "gid://shopify/DraftOrder/276395349" }, "response": { "data": { "draftOrder": { "lineItems": { "edges": [ { "node": { "name": "Boots - Default" } } ] } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/draft_orders/test/unit/graph_api/admin/draft_order_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { draftOrder(id: \\\"gid://shopify/DraftOrder/276395349\\\") { lineItems(first: 5) { edges { node { name } } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n lineItems(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n lineItems(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n lineItems(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n lineItems(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the DraftOrder to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/DraftOrder/276395349\"", "typeKind": "QUERY" } ] } ]