# draftOrder - admin - QUERY Version: 2025-01 ## Description Returns a DraftOrder resource by ID. ### Access Scopes ## Arguments * [id](/docs/api/admin/2025-01/scalars/ID): ID! - The ID of the `DraftOrder` to return. ## Returns * [acceptAutomaticDiscounts](/docs/api/admin/2025-01/scalars/Boolean): Boolean Whether or not to accept automatic discounts on the draft order during calculation. If false, only discount codes and custom draft order discounts (see `appliedDiscount`) will be applied. If true, eligible automatic discounts will be applied in addition to discount codes and custom draft order discounts. * [allVariantPricesOverridden](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether all variant prices have been overridden. * [allowDiscountCodesInCheckout](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether discount codes are allowed during checkout of this draft order. * [anyVariantPricesOverridden](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether any variant prices have been overridden. * [appliedDiscount](/docs/api/admin/2025-01/objects/DraftOrderAppliedDiscount): DraftOrderAppliedDiscount The custom order-level discount applied. * [billingAddress](/docs/api/admin/2025-01/objects/MailingAddress): MailingAddress The billing address of the customer. * [billingAddressMatchesShippingAddress](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether the billing address matches the shipping address. * [completedAt](/docs/api/admin/2025-01/scalars/DateTime): DateTime The date and time when the draft order was converted to a new order, and had it's status changed to **Completed**. * [createdAt](/docs/api/admin/2025-01/scalars/DateTime): DateTime! The date and time when the draft order was created in Shopify. * [currencyCode](/docs/api/admin/2025-01/enums/CurrencyCode): CurrencyCode! The shop currency used for calculation. * [customAttributes](/docs/api/admin/2025-01/objects/Attribute): Attribute! The custom information added to the draft order on behalf of the customer. * [customer](/docs/api/admin/2025-01/objects/Customer): Customer The customer who will be sent an invoice. * [defaultCursor](/docs/api/admin/2025-01/scalars/String): String! A default [cursor](https://shopify.dev/api/usage/pagination-graphql) that returns the single next record, sorted ascending by ID. * [discountCodes](/docs/api/admin/2025-01/scalars/String): String! All discount codes applied. * [email](/docs/api/admin/2025-01/scalars/String): String The email address of the customer, which is used to send notifications. * [hasTimelineComment](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether the merchant has added timeline comments to the draft order. * [id](/docs/api/admin/2025-01/scalars/ID): ID! A globally-unique ID. * [invoiceEmailTemplateSubject](/docs/api/admin/2025-01/scalars/String): String! The subject defined for the draft invoice email template. * [invoiceSentAt](/docs/api/admin/2025-01/scalars/DateTime): DateTime The date and time when the invoice was last emailed to the customer. * [invoiceUrl](/docs/api/admin/2025-01/scalars/URL): URL The link to the checkout, which is sent to the customer in the invoice email. * [legacyResourceId](/docs/api/admin/2025-01/scalars/UnsignedInt64): UnsignedInt64! The ID of the corresponding resource in the REST Admin API. * [lineItemsSubtotalPrice](/docs/api/admin/2025-01/objects/MoneyBag): MoneyBag! A subtotal of the line items and corresponding discounts, excluding include shipping charges, shipping discounts, taxes, or order discounts. * [marketName](/docs/api/admin/2025-01/scalars/String): String! The name of the selected market. * [marketRegionCountryCode](/docs/api/admin/2025-01/enums/CountryCode): CountryCode! The selected country code that determines the pricing. * [metafield](/docs/api/admin/2025-01/objects/Metafield): Metafield A [custom field](https://shopify.dev/docs/apps/build/custom-data), including its `namespace` and `key`, that's associated with a Shopify resource for the purposes of adding and storing additional information. * [name](/docs/api/admin/2025-01/scalars/String): String! The identifier for the draft order, which is unique within the store. For example, _#D1223_. * [note2](/docs/api/admin/2025-01/scalars/String): String The text from an optional note attached to the draft order. * [order](/docs/api/admin/2025-01/objects/Order): Order The order that was created from the draft order. * [paymentTerms](/docs/api/admin/2025-01/objects/PaymentTerms): PaymentTerms The associated payment terms for this draft order. * [phone](/docs/api/admin/2025-01/scalars/String): String The assigned phone number. * [platformDiscounts](/docs/api/admin/2025-01/objects/DraftOrderPlatformDiscount): DraftOrderPlatformDiscount! The list of platform discounts applied. * [poNumber](/docs/api/admin/2025-01/scalars/String): String The purchase order number. * [presentmentCurrencyCode](/docs/api/admin/2025-01/enums/CurrencyCode): CurrencyCode! The payment currency used for calculation. * [purchasingEntity](/docs/api/admin/2025-01/unions/PurchasingEntity): PurchasingEntity The purchasing entity. * [ready](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether the draft order is ready and can be completed. Draft orders might have asynchronous operations that can take time to finish. * [reserveInventoryUntil](/docs/api/admin/2025-01/scalars/DateTime): DateTime The time after which inventory will automatically be restocked. * [shippingAddress](/docs/api/admin/2025-01/objects/MailingAddress): MailingAddress The shipping address of the customer. * [shippingLine](/docs/api/admin/2025-01/objects/ShippingLine): ShippingLine The line item containing the shipping information and costs. * [status](/docs/api/admin/2025-01/enums/DraftOrderStatus): DraftOrderStatus! The status of the draft order. * [subtotalPrice](/docs/api/admin/2025-01/scalars/Money): Money! The subtotal, in shop currency, of the line items and their discounts, excluding shipping charges, shipping discounts, and taxes. * [subtotalPriceSet](/docs/api/admin/2025-01/objects/MoneyBag): MoneyBag! The subtotal, of the line items and their discounts, excluding shipping charges, shipping discounts, and taxes. * [tags](/docs/api/admin/2025-01/scalars/String): String! The comma separated list of tags associated with the draft order. Updating `tags` overwrites any existing tags that were previously added to the draft order. To add new tags without overwriting existing tags, use the [tagsAdd](https://shopify.dev/api/admin-graphql/latest/mutations/tagsadd) mutation. * [taxExempt](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether the draft order is tax exempt. * [taxLines](/docs/api/admin/2025-01/objects/TaxLine): TaxLine! The list of of taxes lines charged for each line item and shipping line. * [taxesIncluded](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether the line item prices include taxes. * [totalDiscountsSet](/docs/api/admin/2025-01/objects/MoneyBag): MoneyBag! Total discounts. * [totalLineItemsPriceSet](/docs/api/admin/2025-01/objects/MoneyBag): MoneyBag! Total price of line items. * [totalPrice](/docs/api/admin/2025-01/scalars/Money): Money! The total price, in shop currency, includes taxes, shipping charges, and discounts. * [totalPriceSet](/docs/api/admin/2025-01/objects/MoneyBag): MoneyBag! The total price, includes taxes, shipping charges, and discounts. * [totalQuantityOfLineItems](/docs/api/admin/2025-01/scalars/Int): Int! The sum of individual line item quantities. If the draft order has bundle items, this is the sum containing the quantities of individual items in the bundle. * [totalShippingPrice](/docs/api/admin/2025-01/scalars/Money): Money! The total shipping price in shop currency. * [totalShippingPriceSet](/docs/api/admin/2025-01/objects/MoneyBag): MoneyBag! The total shipping price. * [totalTax](/docs/api/admin/2025-01/scalars/Money): Money! The total tax in shop currency. * [totalTaxSet](/docs/api/admin/2025-01/objects/MoneyBag): MoneyBag! The total tax. * [totalWeight](/docs/api/admin/2025-01/scalars/UnsignedInt64): UnsignedInt64! The total weight in grams of the draft order. * [transformerFingerprint](/docs/api/admin/2025-01/scalars/String): String Fingerprint of the current cart. In order to have bundles work, the fingerprint must be passed to each request as it was previously returned, unmodified. * [updatedAt](/docs/api/admin/2025-01/scalars/DateTime): DateTime! The date and time when the draft order was last changed. The format is YYYY-MM-DD HH:mm:ss. For example, 2016-02-05 17:04:01. * [visibleToCustomer](/docs/api/admin/2025-01/scalars/Boolean): Boolean! Whether the draft order will be visible to the customer on the self-serve portal. * [warnings](/docs/api/admin/2025-01/interfaces/DraftOrderWarning): DraftOrderWarning! The list of warnings raised while calculating. ## Examples ### Get a draft order by ID Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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" 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" 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" Graphql query: "query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "draftOrder": { "name": "#D1" } } } ### Get a list of draft orders by ID and GraphQL alias Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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" 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" 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" Graphql query: "query {\n draftOrder1: draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n name\n }\n draftOrder2: draftOrder(id: \"gid://shopify/DraftOrder/221448317\") {\n name\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "draftOrder1": { "name": "#D1" }, "draftOrder2": { "name": "#D7" } } } ### Get a list of line item names for a draft order Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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" 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" 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" Graphql query: "query {\n draftOrder(id: \"gid://shopify/DraftOrder/276395349\") {\n lineItems(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "draftOrder": { "lineItems": { "edges": [ { "node": { "name": "Boots - Default" } } ] } } } } ### Get a metafield attached to a draft order Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query DraftOrderMetafield($namespace: String!, $key: String!, $ownerId: ID!) { draftOrder(id: $ownerId) { purchaseOrder: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"purchase_order\",\n \"ownerId\": \"gid://shopify/DraftOrder/276395349\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query DraftOrderMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n draftOrder(id: $ownerId) {\n purchaseOrder: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"purchase_order\",\n \"ownerId\": \"gid://shopify/DraftOrder/276395349\"\n },\n },\n});\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 DraftOrderMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n draftOrder(id: $ownerId) {\n purchaseOrder: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"namespace\": \"my_fields\",\n \"key\": \"purchase_order\",\n \"ownerId\": \"gid://shopify/DraftOrder/276395349\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query DraftOrderMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n draftOrder(id: $ownerId) {\n purchaseOrder: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n {\n variables: {\n \"namespace\": \"my_fields\",\n \"key\": \"purchase_order\",\n \"ownerId\": \"gid://shopify/DraftOrder/276395349\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query DraftOrderMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n draftOrder(id: $ownerId) {\n purchaseOrder: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n}" #### Graphql Input { "namespace": "my_fields", "key": "purchase_order", "ownerId": "gid://shopify/DraftOrder/276395349" } #### Graphql Response { "data": { "draftOrder": { "purchaseOrder": { "value": "123" } } } } ### Get metafields attached to a draft order Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query DraftOrderMetafields($ownerId: ID!) { draftOrder(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }\",\n \"variables\": {\n \"ownerId\": \"gid://shopify/DraftOrder/276395349\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query DraftOrderMetafields($ownerId: ID!) {\n draftOrder(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"ownerId\": \"gid://shopify/DraftOrder/276395349\"\n },\n },\n});\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 DraftOrderMetafields($ownerId: ID!) {\n draftOrder(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"ownerId\": \"gid://shopify/DraftOrder/276395349\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query DraftOrderMetafields($ownerId: ID!) {\n draftOrder(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"ownerId\": \"gid://shopify/DraftOrder/276395349\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query DraftOrderMetafields($ownerId: ID!) {\n draftOrder(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n}" #### Graphql Input { "ownerId": "gid://shopify/DraftOrder/276395349" } #### Graphql Response { "data": { "draftOrder": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "purchase_order", "value": "123" } } ] } } } } ### Receive a single DraftOrder Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query DraftOrder($id: ID!) { draftOrder(id: $id) { id note2 email taxesIncluded currencyCode invoiceSentAt createdAt updatedAt taxExempt completedAt name status lineItems(first: 10) { edges { node { id variant { id title } product { id } name sku vendor quantity requiresShipping taxable isGiftCard fulfillmentService { type } weight { unit value } taxLines { title source rate ratePercentage priceSet { presentmentMoney { amount currencyCode } shopMoney { amount currencyCode } } } appliedDiscount { title value valueType } name custom id } } } shippingAddress { firstName address1 phone city zip province country lastName address2 company latitude longitude name country countryCodeV2 provinceCode } billingAddress { firstName address1 phone city zip province country lastName address2 company latitude longitude name country countryCodeV2 provinceCode } invoiceUrl appliedDiscount { title value valueType } order { id customAttributes { key value } } shippingLine { id title carrierIdentifier custom code deliveryCategory source discountedPriceSet { presentmentMoney { amount currencyCode } shopMoney { amount currencyCode } } } taxLines { channelLiable priceSet { presentmentMoney { amount currencyCode } shopMoney { amount currencyCode } } rate ratePercentage source title } tags customer { id email smsMarketingConsent { consentCollectedFrom consentUpdatedAt marketingOptInLevel marketingState } emailMarketingConsent { consentUpdatedAt marketingOptInLevel marketingState } createdAt updatedAt firstName lastName state amountSpent { amount currencyCode } lastOrder { id name currencyCode } note verifiedEmail multipassIdentifier taxExempt tags phone taxExemptions defaultAddress { id firstName lastName company address1 address2 city province country zip phone name provinceCode countryCodeV2 } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DraftOrder/221448317\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query DraftOrder($id: ID!) {\n draftOrder(id: $id) {\n id\n note2\n email\n taxesIncluded\n currencyCode\n invoiceSentAt\n createdAt\n updatedAt\n taxExempt\n completedAt\n name\n status\n lineItems(first: 10) {\n edges {\n node {\n id\n variant {\n id\n title\n }\n product {\n id\n }\n name\n sku\n vendor\n quantity\n requiresShipping\n taxable\n isGiftCard\n fulfillmentService {\n type\n }\n weight {\n unit\n value\n }\n taxLines {\n title\n source\n rate\n ratePercentage\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n appliedDiscount {\n title\n value\n valueType\n }\n name\n custom\n id\n }\n }\n }\n shippingAddress {\n firstName\n address1\n phone\n city\n zip\n province\n country\n lastName\n address2\n company\n latitude\n longitude\n name\n country\n countryCodeV2\n provinceCode\n }\n billingAddress {\n firstName\n address1\n phone\n city\n zip\n province\n country\n lastName\n address2\n company\n latitude\n longitude\n name\n country\n countryCodeV2\n provinceCode\n }\n invoiceUrl\n appliedDiscount {\n title\n value\n valueType\n }\n order {\n id\n customAttributes {\n key\n value\n }\n }\n shippingLine {\n id\n title\n carrierIdentifier\n custom\n code\n deliveryCategory\n source\n discountedPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n taxLines {\n channelLiable\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n rate\n ratePercentage\n source\n title\n }\n tags\n customer {\n id\n email\n smsMarketingConsent {\n consentCollectedFrom\n consentUpdatedAt\n marketingOptInLevel\n marketingState\n }\n emailMarketingConsent {\n consentUpdatedAt\n marketingOptInLevel\n marketingState\n }\n createdAt\n updatedAt\n firstName\n lastName\n state\n amountSpent {\n amount\n currencyCode\n }\n lastOrder {\n id\n name\n currencyCode\n }\n note\n verifiedEmail\n multipassIdentifier\n taxExempt\n tags\n phone\n taxExemptions\n defaultAddress {\n id\n firstName\n lastName\n company\n address1\n address2\n city\n province\n country\n zip\n phone\n name\n provinceCode\n countryCodeV2\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DraftOrder/221448317\"\n },\n },\n});\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 DraftOrder($id: ID!) {\n draftOrder(id: $id) {\n id\n note2\n email\n taxesIncluded\n currencyCode\n invoiceSentAt\n createdAt\n updatedAt\n taxExempt\n completedAt\n name\n status\n lineItems(first: 10) {\n edges {\n node {\n id\n variant {\n id\n title\n }\n product {\n id\n }\n name\n sku\n vendor\n quantity\n requiresShipping\n taxable\n isGiftCard\n fulfillmentService {\n type\n }\n weight {\n unit\n value\n }\n taxLines {\n title\n source\n rate\n ratePercentage\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n appliedDiscount {\n title\n value\n valueType\n }\n name\n custom\n id\n }\n }\n }\n shippingAddress {\n firstName\n address1\n phone\n city\n zip\n province\n country\n lastName\n address2\n company\n latitude\n longitude\n name\n country\n countryCodeV2\n provinceCode\n }\n billingAddress {\n firstName\n address1\n phone\n city\n zip\n province\n country\n lastName\n address2\n company\n latitude\n longitude\n name\n country\n countryCodeV2\n provinceCode\n }\n invoiceUrl\n appliedDiscount {\n title\n value\n valueType\n }\n order {\n id\n customAttributes {\n key\n value\n }\n }\n shippingLine {\n id\n title\n carrierIdentifier\n custom\n code\n deliveryCategory\n source\n discountedPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n taxLines {\n channelLiable\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n rate\n ratePercentage\n source\n title\n }\n tags\n customer {\n id\n email\n smsMarketingConsent {\n consentCollectedFrom\n consentUpdatedAt\n marketingOptInLevel\n marketingState\n }\n emailMarketingConsent {\n consentUpdatedAt\n marketingOptInLevel\n marketingState\n }\n createdAt\n updatedAt\n firstName\n lastName\n state\n amountSpent {\n amount\n currencyCode\n }\n lastOrder {\n id\n name\n currencyCode\n }\n note\n verifiedEmail\n multipassIdentifier\n taxExempt\n tags\n phone\n taxExemptions\n defaultAddress {\n id\n firstName\n lastName\n company\n address1\n address2\n city\n province\n country\n zip\n phone\n name\n provinceCode\n countryCodeV2\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DraftOrder/221448317\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query DraftOrder($id: ID!) {\n draftOrder(id: $id) {\n id\n note2\n email\n taxesIncluded\n currencyCode\n invoiceSentAt\n createdAt\n updatedAt\n taxExempt\n completedAt\n name\n status\n lineItems(first: 10) {\n edges {\n node {\n id\n variant {\n id\n title\n }\n product {\n id\n }\n name\n sku\n vendor\n quantity\n requiresShipping\n taxable\n isGiftCard\n fulfillmentService {\n type\n }\n weight {\n unit\n value\n }\n taxLines {\n title\n source\n rate\n ratePercentage\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n appliedDiscount {\n title\n value\n valueType\n }\n name\n custom\n id\n }\n }\n }\n shippingAddress {\n firstName\n address1\n phone\n city\n zip\n province\n country\n lastName\n address2\n company\n latitude\n longitude\n name\n country\n countryCodeV2\n provinceCode\n }\n billingAddress {\n firstName\n address1\n phone\n city\n zip\n province\n country\n lastName\n address2\n company\n latitude\n longitude\n name\n country\n countryCodeV2\n provinceCode\n }\n invoiceUrl\n appliedDiscount {\n title\n value\n valueType\n }\n order {\n id\n customAttributes {\n key\n value\n }\n }\n shippingLine {\n id\n title\n carrierIdentifier\n custom\n code\n deliveryCategory\n source\n discountedPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n taxLines {\n channelLiable\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n rate\n ratePercentage\n source\n title\n }\n tags\n customer {\n id\n email\n smsMarketingConsent {\n consentCollectedFrom\n consentUpdatedAt\n marketingOptInLevel\n marketingState\n }\n emailMarketingConsent {\n consentUpdatedAt\n marketingOptInLevel\n marketingState\n }\n createdAt\n updatedAt\n firstName\n lastName\n state\n amountSpent {\n amount\n currencyCode\n }\n lastOrder {\n id\n name\n currencyCode\n }\n note\n verifiedEmail\n multipassIdentifier\n taxExempt\n tags\n phone\n taxExemptions\n defaultAddress {\n id\n firstName\n lastName\n company\n address1\n address2\n city\n province\n country\n zip\n phone\n name\n provinceCode\n countryCodeV2\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DraftOrder/221448317\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query DraftOrder($id: ID!) {\n draftOrder(id: $id) {\n id\n note2\n email\n taxesIncluded\n currencyCode\n invoiceSentAt\n createdAt\n updatedAt\n taxExempt\n completedAt\n name\n status\n lineItems(first: 10) {\n edges {\n node {\n id\n variant {\n id\n title\n }\n product {\n id\n }\n name\n sku\n vendor\n quantity\n requiresShipping\n taxable\n isGiftCard\n fulfillmentService {\n type\n }\n weight {\n unit\n value\n }\n taxLines {\n title\n source\n rate\n ratePercentage\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n appliedDiscount {\n title\n value\n valueType\n }\n name\n custom\n id\n }\n }\n }\n shippingAddress {\n firstName\n address1\n phone\n city\n zip\n province\n country\n lastName\n address2\n company\n latitude\n longitude\n name\n country\n countryCodeV2\n provinceCode\n }\n billingAddress {\n firstName\n address1\n phone\n city\n zip\n province\n country\n lastName\n address2\n company\n latitude\n longitude\n name\n country\n countryCodeV2\n provinceCode\n }\n invoiceUrl\n appliedDiscount {\n title\n value\n valueType\n }\n order {\n id\n customAttributes {\n key\n value\n }\n }\n shippingLine {\n id\n title\n carrierIdentifier\n custom\n code\n deliveryCategory\n source\n discountedPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n taxLines {\n channelLiable\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n rate\n ratePercentage\n source\n title\n }\n tags\n customer {\n id\n email\n smsMarketingConsent {\n consentCollectedFrom\n consentUpdatedAt\n marketingOptInLevel\n marketingState\n }\n emailMarketingConsent {\n consentUpdatedAt\n marketingOptInLevel\n marketingState\n }\n createdAt\n updatedAt\n firstName\n lastName\n state\n amountSpent {\n amount\n currencyCode\n }\n lastOrder {\n id\n name\n currencyCode\n }\n note\n verifiedEmail\n multipassIdentifier\n taxExempt\n tags\n phone\n taxExemptions\n defaultAddress {\n id\n firstName\n lastName\n company\n address1\n address2\n city\n province\n country\n zip\n phone\n name\n provinceCode\n countryCodeV2\n }\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/DraftOrder/221448317" } #### Graphql Response { "data": { "draftOrder": { "id": "gid://shopify/DraftOrder/221448317", "note2": "gift", "email": "bobsemail@shopify.com", "taxesIncluded": false, "currencyCode": "USD", "invoiceSentAt": null, "createdAt": "2017-01-01T00:00:00Z", "updatedAt": "2021-12-01T12:43:00Z", "taxExempt": false, "completedAt": null, "name": "#D7", "status": "OPEN", "lineItems": { "edges": [ { "node": { "id": "gid://shopify/DraftOrderLineItem/227425250", "variant": { "id": "gid://shopify/ProductVariant/330284860", "title": "Default" }, "product": { "id": "gid://shopify/Product/558169081" }, "name": "Unpublished Boots - Default", "sku": "unpublished_boots-12", "vendor": "Greedy Boot Maker", "quantity": 5, "requiresShipping": true, "taxable": true, "isGiftCard": false, "fulfillmentService": { "type": "MANUAL" }, "weight": { "unit": "GRAMS", "value": 10.0 }, "taxLines": [ { "title": "GST", "source": "Shopify", "rate": 0.07, "ratePercentage": 7.0, "priceSet": { "presentmentMoney": { "amount": "42.53", "currencyCode": "USD" }, "shopMoney": { "amount": "42.53", "currencyCode": "USD" } } }, { "title": "PST", "source": "Shopify", "rate": 0.08, "ratePercentage": 8.0, "priceSet": { "presentmentMoney": { "amount": "48.6", "currencyCode": "USD" }, "shopMoney": { "amount": "48.6", "currencyCode": "USD" } } } ], "appliedDiscount": null, "custom": false } }, { "node": { "id": "gid://shopify/DraftOrderLineItem/446166744", "variant": { "id": "gid://shopify/ProductVariant/445365074", "title": "Medium" }, "product": { "id": "gid://shopify/Product/910489600" }, "name": "Crafty Shoes - Green", "sku": "crappy_shoes_green", "vendor": "Crappy Cobbler", "quantity": 2, "requiresShipping": false, "taxable": true, "isGiftCard": false, "fulfillmentService": { "type": "MANUAL" }, "weight": { "unit": "GRAMS", "value": 10.0 }, "taxLines": [ { "title": "PST", "source": "Shopify", "rate": 0.08, "ratePercentage": 8.0, "priceSet": { "presentmentMoney": { "amount": "13.68", "currencyCode": "USD" }, "shopMoney": { "amount": "13.68", "currencyCode": "USD" } } }, { "title": "GST", "source": "Shopify", "rate": 0.07, "ratePercentage": 7.0, "priceSet": { "presentmentMoney": { "amount": "11.97", "currencyCode": "USD" }, "shopMoney": { "amount": "11.97", "currencyCode": "USD" } } } ], "appliedDiscount": { "title": null, "value": 5.0, "valueType": "FIXED_AMOUNT" }, "custom": false } }, { "node": { "id": "gid://shopify/DraftOrderLineItem/654123718", "variant": null, "product": null, "name": "Fingerless wool gloves", "sku": "fingerless_wool_gloves", "vendor": "Bear Hands", "quantity": 2, "requiresShipping": true, "taxable": true, "isGiftCard": false, "fulfillmentService": { "type": "MANUAL" }, "weight": { "unit": "GRAMS", "value": 50.0 }, "taxLines": [ { "title": "PST", "source": "Shopify", "rate": 0.08, "ratePercentage": 8.0, "priceSet": { "presentmentMoney": { "amount": "10.8", "currencyCode": "USD" }, "shopMoney": { "amount": "10.8", "currencyCode": "USD" } } }, { "title": "GST", "source": "Shopify", "rate": 0.07, "ratePercentage": 7.0, "priceSet": { "presentmentMoney": { "amount": "9.45", "currencyCode": "USD" }, "shopMoney": { "amount": "9.45", "currencyCode": "USD" } } } ], "appliedDiscount": null, "custom": true } } ] }, "shippingAddress": { "firstName": "Bob", "address1": "123 Amoebobacterieae St", "phone": "+1(613)555-1212", "city": "Ottawa", "zip": "K2P0V6", "province": "Ontario", "country": "Canada", "lastName": "Bobsen", "address2": "", "company": "", "latitude": 45.41634, "longitude": -75.6868, "name": "Bob Bobsen", "countryCodeV2": "CA", "provinceCode": "ON" }, "billingAddress": { "firstName": "Bob", "address1": "123 Amoebobacterieae St", "phone": "+1(613)555-1212", "city": "Ottawa", "zip": "K2P0V6", "province": "Ontario", "country": "Canada", "lastName": "Bobsen", "address2": "", "company": "", "latitude": 45.41634, "longitude": -75.6868, "name": "Bob Bobsen", "countryCodeV2": "CA", "provinceCode": "ON" }, "invoiceUrl": "https://www.snowdevil.ca/26371970/invoices/ba8dcf6c022ccad3d47e3909e378e22f", "appliedDiscount": { "title": "Custom", "value": 10.0, "valueType": "PERCENTAGE" }, "order": null, "shippingLine": { "id": "gid://shopify/ShippingLine/671422168?type=draft_order", "title": "custom shipping", "carrierIdentifier": null, "custom": true, "code": "custom", "deliveryCategory": "shipping", "source": "shopify", "discountedPriceSet": { "presentmentMoney": { "amount": "12.25", "currencyCode": "USD" }, "shopMoney": { "amount": "12.25", "currencyCode": "USD" } } }, "taxLines": [ { "channelLiable": null, "priceSet": { "presentmentMoney": { "amount": "73.08", "currencyCode": "USD" }, "shopMoney": { "amount": "73.08", "currencyCode": "USD" } }, "rate": 0.08, "ratePercentage": 8.0, "source": null, "title": "PST" }, { "channelLiable": null, "priceSet": { "presentmentMoney": { "amount": "63.95", "currencyCode": "USD" }, "shopMoney": { "amount": "63.95", "currencyCode": "USD" } }, "rate": 0.07, "ratePercentage": 7.0, "source": null, "title": "GST" } ], "tags": [ "High priority", "Wholesale" ], "customer": { "id": "gid://shopify/Customer/544365967", "email": "bob@example.com", "smsMarketingConsent": { "consentCollectedFrom": "OTHER", "consentUpdatedAt": "2021-06-16T17:31:44Z", "marketingOptInLevel": "SINGLE_OPT_IN", "marketingState": "SUBSCRIBED" }, "emailMarketingConsent": { "consentUpdatedAt": "2005-06-16T15:00:11Z", "marketingOptInLevel": "SINGLE_OPT_IN", "marketingState": "SUBSCRIBED" }, "createdAt": "2005-06-15T15:57:11Z", "updatedAt": "2005-06-16T15:57:11Z", "firstName": "Bob", "lastName": "Bobsen", "state": "ENABLED", "amountSpent": { "amount": "8305.6", "currencyCode": "USD" }, "lastOrder": null, "note": null, "verifiedEmail": true, "multipassIdentifier": null, "taxExempt": false, "tags": [ "Bob", "Canadian", "Léon", "Noël" ], "phone": "+13125551212", "taxExemptions": [], "defaultAddress": { "id": "gid://shopify/MailingAddress/544365967?model_name=CustomerAddress", "firstName": "Bob", "lastName": "Bobsen", "company": "", "address1": "123 Amoebobacterieae St", "address2": "", "city": "Ottawa", "province": "Ontario", "country": "Canada", "zip": "K2P0V6", "phone": "+1(613)555-1212", "name": "Bob Bobsen", "provinceCode": "ON", "countryCodeV2": "CA" } } } } }