订单草稿-DraftOrder 对象
代表订单草稿。商家可以使用订单草稿代表客户创建订单。
所需的访问
read_draft_orders 访问范围。
在本页面
Connections
- 活动(
[EventConnection!](https://shopify.dev/docs/admin-api/graphql/reference/events/eventconnection))
与草稿订单相关的事件列表。 
| 争论 | 描述 | 
|---|---|
after() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之后的元素。 | 
before() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之前的元素。 | 
first() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的第一个元素。 | 
last() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的最后一个元素。 | 
query() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
支持的过滤器参数: + comments+ created_at+ subject_type+ verb有关使用过滤器的更多信息,请参见详细的搜索语法。  | 
reverse() [Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01) | 
颠倒基础列表的顺序。 默认值: false | 
sortKey() [EventSortKeys](https://shopify.dev/docs/admin-api/graphql/reference/events/eventsortkeys) | 
按给定键对基础列表进行排序。 默认值: ID | 
- lineItems(
[DraftOrderLineItemConnection!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderlineitem))
订单草稿中的订单项列表。 
| 争论 | 描述 | 
|---|---|
after() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之后的元素。 | 
before() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之前的元素。 | 
first() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的第一个元素。 | 
last() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的最后一个元素。 | 
reverse() [Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01) | 
颠倒基础列表的顺序。 默认值: false | 
- localizationExtensions(
[LocalizationExtensionConnection!](https://shopify.dev/docs/admin-api/graphql/reference/translations/localizationextensionconnection))
资源的本地化扩展列表。 
| 争论 | 描述 | 
|---|---|
after() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之后的元素。 | 
before() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之前的元素。 | 
countryCodes() [[CountryCode!]](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/countrycode) | 
扩展名的国家代码。 | 
first() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的第一个元素。 | 
last() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的最后一个元素。 | 
purposes() [[LocalizationExtensionPurpose!]](https://shopify.dev/docs/admin-api/graphql/reference/translations/localizationextensionpurpose) | 
扩展的目的。 | 
reverse() [Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01) | 
颠倒基础列表的顺序。 默认值: false | 
- 元字段(
[MetafieldConnection!](https://shopify.dev/docs/admin-api/graphql/reference/metafields/metafieldconnection))
与资源关联的元字段的分页列表。 
| 争论 | 描述 | 
|---|---|
after() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之后的元素。 | 
before() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之前的元素。 | 
first() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的第一个元素。 | 
last() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的最后一个元素。 | 
namespace() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
在资源下查找具有特定名称空间的所有元字段。 | 
reverse() [Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01) | 
颠倒基础列表的顺序。 默认值: false | 
- privateMetafields(
[PrivateMetafieldConnection!](https://shopify.dev/docs/admin-api/graphql/reference/metafields/privatemetafieldconnection))
私有元字段列表。 
| 争论 | 描述 | 
|---|---|
after() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之后的元素。 | 
before() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
返回指定游标之前的元素。 | 
first() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的第一个元素。 | 
last() [Int](https://shopify.dev/docs/admin-api/graphql/reference/scalar#int-2021-01) | 
返回n列表中的最后一个元素。 | 
namespace() [String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01) | 
按名称空间过滤私有元字段。 | 
reverse() [Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01) | 
颠倒基础列表的顺序。 默认值: false | 
字段
- AppliedDiscount(
[DraftOrderAppliedDiscount](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderapplieddiscount))
订单级折扣应用于订单草稿。 - billingAddress(
[MailingAddress](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/mailingaddress))
客户的帐单地址。 - completedAt(
[DateTime](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
草稿订单转换为新订单的日期和时间,草稿订单的状态更改为已完成。 - createdAt(
[DateTime!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
在Shopify中创建订单草稿的日期和时间。 - currencyCode(
[CurrencyCode!](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/currencycode))
发送发票时商店货币的三个字母代码。 - customAttributes(
[[Attribute!]!](https://shopify.dev/docs/admin-api/graphql/reference/orders/attribute))
代表您的客户添加到订单草稿中的自定义信息。 - 客户(
[Customer](https://shopify.dev/docs/admin-api/graphql/reference/customers/customer))
如果有订单草稿,将向其发送发票的客户。 - 电子邮件(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
客户的电子邮件地址,用于向其发送通知。 - hasTimelineComment(
[Boolean!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
商家是否已向草稿订单添加时间轴注释。 - 编号(
[ID!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
全局唯一标识符。 - invoiceSentAt(
[DateTime](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
发票上次通过电子邮件发送给客户的日期和时间。 - invoiceUrl(
[URL](https://shopify.dev/docs/admin-api/graphql/reference/scalar#url-2021-01))
链接到结帐,结帐会通过发票电子邮件发送给您的客户。 - legacyResourceId(
[UnsignedInt64!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#unsignedint64-2021-01))
REST Admin API中相应资源的ID。 - 元字段(
[Metafield](https://shopify.dev/docs/admin-api/graphql/reference/metafields/metafield))
与资源关联的元字段。 
- 名称(
[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
订单草稿的唯一标识符,在商店内是唯一的。例如#D1223。 - 注意2(
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
订单草稿随附的可选注释中的文本。 - 订购(
[Order](https://shopify.dev/docs/admin-api/graphql/reference/orders/order))
从该订单草稿创建的订单。 - privateMetafield(
[PrivateMetafield](https://shopify.dev/docs/admin-api/graphql/reference/metafields/privatemetafield))
返回通过名称空间和键找到的私有元字段。 
- 准备好(
[Boolean!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
草稿订单是否准备就绪并且可以完成。草稿订单可能具有异步操作,可能需要一些时间才能完成。 - shippingAddress(
[MailingAddress](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/mailingaddress))
客户的送货地址。 - shippingLine(
[ShippingLine](https://shopify.dev/docs/admin-api/graphql/reference/orders/shippingline))
包含运输费用的订单项。 - 状态(
[DraftOrderStatus!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderstatus))
订单草稿的状态。 - 小计价格(
[Money!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#money-2021-01))
订单项及其折扣的小计(不包含运输费用,运输折扣或税金)。 - 标签(
[[String!]!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
与草稿订单相关的标签的逗号分隔列表。更新将tags覆盖以前添加到草稿订单中的所有现有标签。要添加新标签而不覆盖现有标签,请使用tagsAdd 突变。 - taxExempt(
[Boolean!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
订单草稿是否免税。 - taxLines(
[[TaxLine!]!](https://shopify.dev/docs/admin-api/graphql/reference/orders/taxline))
每个订单项和运输行收取的税金总额。 - 已含税(
[Boolean!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
订单项价格是否包含税。 - totalPrice(
[Money!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#money-2021-01))
订单草稿的总金额(包括税金,运费和折扣)。 - totalShippingPrice(
[Money!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#money-2021-01))
订单草稿的总运费。 - 总税(
[Money!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#money-2021-01))
订单草稿的税金总额。 - 总重量(
[UnsignedInt64!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#unsignedint64-2021-01))
订单草稿的总重量(克)。 - UpdatedAt(
[DateTime!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
订单草稿的最后更改日期和时间。格式为YYYY-MM-DD HH:mm:ss(例如,2016-02-05 17:04:01)。 
返回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)
DraftOrder的变异
- draftOrderCalculate
计算草稿订单的属性。在无需实际创建订单草稿的情况下确定总税或价格等信息时很有用。 - draftOrderComplete
完成订单草稿并创建订单。 - draftOrderCreate
创建草稿订单。 - draftOrderDelete
删除订单草稿。 - draftOrderInvoicePreview
预览订单草稿发票电子邮件。 - draftOrderInvoiceSend
发送草稿订单的电子邮件发票。 - draftOrderUpdate
更新订单草稿。 
派生关系
[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)
自动生成的类型,用于通过多个DraftOrders分页。
在本页面
字段
- 边(
[[DraftOrderEdge!]!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder))
边列表。 - pageInfo(
[PageInfo!](https://shopify.dev/docs/admin-api/graphql/reference/pageinfo))
有助于分页的信息。 
一种自动生成的类型,在分页期间包含一个DraftOrder和一个光标。
在本页面
字段
- cursor(
[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
用于分页的光标。 - node(
[DraftOrder!](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder))
该项目位于DraftOrderEdge的末尾。 
返回DraftOrderEdge的类型
[DraftOrderConnection.edges](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder#edges-2021-01)
