All Release Notes

Added support for Direct Discounts in the GraphQL API

6 September 2022
Composable Commerce
HTTP API
Enhancement
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 Quote type:
    • Added the directDiscounts field to the Quote type.
  • [GraphQL API] Changed the QuoteRequest type:
    • Added the directDiscounts field to the QuoteRequest type.
  • [GraphQL API] Changed the CartUpdateAction type:
    • Input field setDirectDiscounts was added to CartUpdateAction type
  • [GraphQL API] Changed the Cart type:
    • Added the directDiscounts field to the Cart type.
  • [GraphQL API] Changed the StagedOrderUpdateAction type:
    • Input field setDirectDiscounts was added to StagedOrderUpdateAction type
  • [GraphQL API] Changed the Order type:
    • Added the directDiscounts field to the Order type.

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!]!
}