截至 GraphQL Customer Account API 2026-07 版本,草稿订单现在会展示折扣应用信息。
您可以在DraftOrder上使用新的discountApplications字段来查询应用于草稿订单的折扣,并在DraftOrderLineItem上使用新的discountAllocations字段来查询折扣如何分配到各个行项目。
例如:
query DraftOrderDiscounts($id: ID!) { draftOrder(id: $id) { discountApplications(first: 10) { nodes { __typename ... on DiscountCodeApplication { code } ... on ManualDiscountApplication { title } allocationMethod targetSelection targetType value { ... on MoneyV2 { amount currencyCode } ... on PricingPercentageValue { percentage } } } } lineItems(first: 10) { nodes { title discountAllocations { allocatedAmount { amount currencyCode } discountApplication { __typename } } } } } }使用这些字段来了解哪些折扣适用于草稿订单,以及这些折扣如何影响草稿订单项。

