6 September 2022
GraphQLPricing and Discounts
Direct Discounts on Carts are now supported in the GraphQL API. The feature has been released in beta in the HTTP API on 30 June 2022.
Changes:
- [GraphQL API] Added the following types to the GraphQL schema: 
DirectDiscount,DirectDiscountDraft,DirectDiscountDraftOutput,SetCartDirectDiscounts,SetStagedOrderDirectDiscounts,SetStagedOrderDirectDiscountsOutput. - [GraphQL API] Changed the 
Quotetype:- Added the 
directDiscountsfield to theQuotetype. 
 - Added the 
 - [GraphQL API] Changed the 
QuoteRequesttype:- Added the 
directDiscountsfield to theQuoteRequesttype. 
 - Added the 
 - [GraphQL API] Changed the 
CartUpdateActiontype:- Input field 
setDirectDiscountswas added toCartUpdateActiontype 
 - Input field 
 - [GraphQL API] Changed the 
Carttype:- Added the 
directDiscountsfield to theCarttype. 
 - Added the 
 - [GraphQL API] Changed the 
StagedOrderUpdateActiontype:- Input field 
setDirectDiscountswas added toStagedOrderUpdateActiontype 
 - Input field 
 - [GraphQL API] Changed the 
Ordertype:- Added the 
directDiscountsfield to theOrdertype. 
 - Added the 
 
The following changes were introduced in terms of GraphQL SDL:
extend type Cart {
  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  directDiscounts: [DirectDiscount!]!
}
extend type Quote {
  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  directDiscounts: [DirectDiscount!]!
}
extend type ProductAssignment {
  variantSelection: ProductVariantSelection
}
extend type Order {
  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  directDiscounts: [DirectDiscount!]!
}
extend input CartUpdateAction {
  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  setDirectDiscounts: SetCartDirectDiscounts
}
extend input StagedOrderUpdateAction {
  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  setDirectDiscounts: SetStagedOrderDirectDiscounts
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type DirectDiscount {
  id: String!
  value: CartDiscountValue!
  target: CartDiscountTarget
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input DirectDiscountDraft {
  value: CartDiscountValueInput!
  target: CartDiscountTargetInput
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type DirectDiscountDraftOutput {
  value: CartDiscountValue!
  target: CartDiscountTarget
}
input SetCartDirectDiscounts {
  discounts: [DirectDiscountDraft!]!
}
input SetStagedOrderDirectDiscounts {
  discounts: [DirectDiscountDraft!]!
}
type SetStagedOrderDirectDiscountsOutput implements StagedOrderUpdateActionOutput {
  type: String!
  discounts: [DirectDiscountDraftOutput!]!
}