DraftOrder object

Represents a draft order. Merchants can use draft orders to create orders on behalf of their customers.

Required access

read_draft_orders access scope.

On this page

Connections

  • events ([EventConnection!](https://shopify.dev/docs/admin-api/graphql/reference/events/eventconnection))
    List of events associated with the draft order.
Argument Description
after
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come after the specified cursor.
before
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come before the specified cursor.
first
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the first n elements from the list.
last
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the last n elements from the list.
query
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Supported filter parameters:
+ comments
+ created_at
+ subject_type
+ verb
See the detailed search syntax for more information about using filters.
reverse
(
[Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01)

)
Reverse the order of the underlying list.
Default value: false
sortKey
(
[EventSortKeys](https://shopify.dev/docs/admin-api/graphql/reference/events/eventsortkeys)

)
Sort the underlying list by the given key.
Default value: ID
  • lineItems ([DraftOrderLineItemConnection!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderlineitem))
    List of the line items in the draft order.
Argument Description
after
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come after the specified cursor.
before
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come before the specified cursor.
first
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the first n elements from the list.
last
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the last n elements from the list.
reverse
(
[Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01)

)
Reverse the order of the underlying list.
Default value: false
  • localizationExtensions ([LocalizationExtensionConnection!](https://shopify.dev/docs/admin-api/graphql/reference/translations/localizationextensionconnection))
    List of localization extensions for the resource.
Argument Description
after
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come after the specified cursor.
before
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come before the specified cursor.
countryCodes
(
[[CountryCode!]](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/countrycode)

)
The country codes of the extensions.
first
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the first n elements from the list.
last
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the last n elements from the list.
purposes
(
[[LocalizationExtensionPurpose!]](https://shopify.dev/docs/admin-api/graphql/reference/translations/localizationextensionpurpose)

)
The purpose of the extensions.
reverse
(
[Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01)

)
Reverse the order of the underlying list.
Default value: false
  • metafields ([MetafieldConnection!](https://shopify.dev/docs/admin-api/graphql/reference/metafields/metafieldconnection))
    A paginated list of metafields associated with the resource.
Argument Description
after
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come after the specified cursor.
before
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come before the specified cursor.
first
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the first n elements from the list.
last
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the last n elements from the list.
namespace
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Finds all metafields with a specific namespace under the resource.
reverse
(
[Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01)

)
Reverse the order of the underlying list.
Default value: false
  • privateMetafields ([PrivateMetafieldConnection!](https://shopify.dev/docs/admin-api/graphql/reference/metafields/privatemetafieldconnection))
    List of private metafields.
Argument Description
after
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come after the specified cursor.
before
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Returns the elements that come before the specified cursor.
first
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the first n elements from the list.
last
(
[Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01)

)
Returns up to the last n elements from the list.
namespace
(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

)
Filter the private metafields by namespace.
reverse
(
[Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01)

)
Reverse the order of the underlying list.
Default value: false
  • Fields

  • appliedDiscount ([DraftOrderAppliedDiscount](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderapplieddiscount))
    Order-level discount applied to the draft order.
  • billingAddress ([MailingAddress](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/mailingaddress))
    The billing address of the customer.
  • completedAt ([DateTime](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
    Date and time when the draft order converted to a new order, and the draft order’s status changed to Completed.
  • createdAt ([DateTime!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
    Date and time when the draft order was created in Shopify.
  • currencyCode ([CurrencyCode!](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/currencycode))
    Three letter code for the currency of the store at the time that the invoice is sent.
  • customAttributes ([[Attribute!]!](https://shopify.dev/docs/admin-api/graphql/reference/orders/attribute))
    Custom information added to the draft order on behalf of your customer.
  • customer ([Customer](https://shopify.dev/docs/admin-api/graphql/reference/customers/customer))
    Customer who will be sent an invoice for the draft order, if there is one.
  • email ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    Email address of the customer, which is used to send notifications to.
  • hasTimelineComment ([Boolean!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
    Whether the merchant has added timeline comments to the draft order.
  • id ([ID!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
    Globally unique identifier.
  • invoiceSentAt ([DateTime](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
    Date and time when the invoice was last emailed to the customer.
  • invoiceUrl ([URL](https://shopify.dev/docs/admin-api/graphql/reference/scalar#url-2021-01))
    Link to the checkout, which is sent to your customer in the invoice email.
  • legacyResourceId ([UnsignedInt64!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#unsignedint64-2021-01))
    The ID of the corresponding resource in the REST Admin API.
  • metafield ([Metafield](https://shopify.dev/docs/admin-api/graphql/reference/metafields/metafield))
    The metafield associated with the resource.
Argument Description
key
(
[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

) REQUIRED
Identifier for the metafield (maximum of 30 characters).
namespace
(
[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

) REQUIRED
Container for a set of metafields (maximum of 20 characters).
  • name ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    Unique identifier for the draft order, which is unique within the store. For example, #D1223.
  • note2 ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    Text from an optional note attached to the draft order.
  • order ([Order](https://shopify.dev/docs/admin-api/graphql/reference/orders/order))
    Order that was created from this draft order.
  • privateMetafield ([PrivateMetafield](https://shopify.dev/docs/admin-api/graphql/reference/metafields/privatemetafield))
    Returns a private metafield found by namespace and key.
Argument Description
key
(
[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

) REQUIRED
The key for the private metafield.
namespace
(
[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

) REQUIRED
The namespace for the private metafield.
  • ready ([Boolean!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
    Whether or not the Draft Order is ready and can be completed. Draft Orders may have asynchronous operations that can take time to finish.
  • shippingAddress ([MailingAddress](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/mailingaddress))
    The shipping address of the customer.
  • shippingLine ([ShippingLine](https://shopify.dev/docs/admin-api/graphql/reference/orders/shippingline))
    Line item that contains the shipping costs.
  • status ([DraftOrderStatus!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderstatus))
    Status of the draft order.
  • subtotalPrice ([Money!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#money-2021-01))
    Subtotal of the line items and their discounts (does not contain shipping charges or shipping discounts, or taxes).
  • tags ([[String!]!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    A 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 mutation.
  • taxExempt ([Boolean!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
    Whether the draft order is tax exempt.
  • taxLines ([[TaxLine!]!](https://shopify.dev/docs/admin-api/graphql/reference/orders/taxline))
    Total amount of taxes charged for each line item and shipping line.
  • taxesIncluded ([Boolean!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
    Whether the line item prices include taxes.
  • totalPrice ([Money!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#money-2021-01))
    Total amount of the draft order (includes taxes, shipping charges, and discounts).
  • totalShippingPrice ([Money!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#money-2021-01))
    Total shipping charge for the draft order.
  • totalTax ([Money!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#money-2021-01))
    Total amount of taxes for the draft order.
  • totalWeight ([UnsignedInt64!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#unsignedint64-2021-01))
    Total weight (grams) of the draft order.
  • updatedAt ([DateTime!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
    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).

Types that return DraftOrder

  • [QueryRoot.draftOrder](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/queryroot#draftorder-2021-01)
  • [QueryRoot.draftOrders](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/queryroot#draftorders-2021-01)

Mutations for DraftOrder

Implements

  • [CommentEventSubject](https://shopify.dev/docs/admin-api/graphql/reference/events/commenteventsubject)
  • [HasEvents](https://shopify.dev/docs/admin-api/graphql/reference/events/hasevents)
  • [HasLocalizationExtensionsForDraftOrders](https://shopify.dev/docs/admin-api/graphql/reference/translations/haslocalizationextensionsfordraftorders)
  • [HasMetafields](https://shopify.dev/docs/admin-api/graphql/reference/metafields/hasmetafields)
  • [LegacyInteroperability](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/legacyinteroperability)
  • [Node](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/node)

An auto-generated type for paginating through multiple DraftOrders.

On this page

Fields

  • edges ([[DraftOrderEdge!]!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder))
    A list of edges.
  • pageInfo ([PageInfo!](https://shopify.dev/docs/admin-api/graphql/reference/pageinfo))
    Information to aid in pagination.

An auto-generated type which holds one DraftOrder and a cursor during pagination.

On this page

Fields

  • cursor ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    A cursor for use in pagination.
  • node ([DraftOrder!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder))
    The item at the end of DraftOrderEdge.

Types that return DraftOrderEdge

  • [DraftOrderConnection.edges](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder#edges-2021-01)