draftOrderCreate mutation
Creates a draft order.
Required access
write_draft_orders
access scope.
On this page
Interactive example
This is an example mutation query. Use the embedded interactive tool below to edit the query.
Hint: use Ctrl + Space for autocompleting fields.
mutation draftOrderCreate($input: DraftOrderInput!) { draftOrderCreate(input: $input) {} } { “input”: {} }
<font style="color:#1F61A0;">draftOrder</font> <font style="color:#555555;">{</font>
<font style="color:#1F61A0;">id</font>
<font style="color:#555555;">}</font>
<font style="color:#1F61A0;">userErrors</font> <font style="color:#555555;">{</font>
<font style="color:#1F61A0;">field</font>
<font style="color:#1F61A0;">message</font>
<font style="color:#555555;">}</font>
Arguments
Argument | Description |
---|---|
input ( [DraftOrderInput!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderinput) ) REQUIRED |
The fields used to create the draft order. |
DraftOrderInput fields
- appliedDiscount (
[DraftOrderAppliedDiscountInput](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderapplieddiscountinput)
)
The discount that will be applied to the draft order. A draft order line item can have one discount. A draft order can also have one order-level discount. - billingAddress (
[MailingAddressInput](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/mailingaddressinput)
)
The mailing address associated with the payment method. - customAttributes (
[[AttributeInput!]](https://shopify.dev/docs/admin-api/graphql/reference/orders/attributeinput)
)
Extra information added to the customer. - customerId (
[ID](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01)
)
Customer associated with the draft order. - email (
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)
)
The customer’s email address. - lineItems (
[[DraftOrderLineItemInput!]](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderlineiteminput)
)
Product variant line item or custom line item associated to the draft order. Each draft order must include at least one line item. - localizationExtensions (
[[LocalizationExtensionInput!]](https://shopify.dev/docs/admin-api/graphql/reference/translations/localizationextensioninput)
)
The localization extensions attached to the draft order. For example, Tax IDs. - metafields (
[[MetafieldInput!]](https://shopify.dev/docs/admin-api/graphql/reference/metafields/metafieldinput)
)
Metafields attached to the draft order. - note (
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)
)
The text of an optional note that a shop owner can attach to the draft order. - privateMetafields (
[[PrivateMetafieldInput!]](https://shopify.dev/docs/admin-api/graphql/reference/metafields/privatemetafieldinput)
)
The private metafields attached to the draft order. - shippingAddress (
[MailingAddressInput](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/mailingaddressinput)
)
The mailing address to where the order will be shipped. - shippingLine (
[ShippingLineInput](https://shopify.dev/docs/admin-api/graphql/reference/orders/shippinglineinput)
)
A shipping line object, which details the shipping method used. - tags (
[[String!]](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)
)
A comma separated list of tags that have been added to the draft order. - taxExempt (
[Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01)
)
Whether or not taxes are exempt for the draft order. If false, then Shopify will refer to the taxable field for each line item. If a customer is applied to the draft order, then Shopify will use the customer’s tax exempt field instead. - useCustomerDefaultAddress (
[Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01)
)
Sent as part of a draft order object to load customer shipping information.
Return fields
- draftOrder (
[DraftOrder](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder)
)
The created draft order. - userErrors (
[[UserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/usererror)
)
List of errors that occurred executing the mutation.