17 December 2024
Pricing and DiscountsAudit LogGraphQL
We've introduced a new target for Cart Discounts, CartDiscountPatternTarget, in public beta. This enhancement provides greater flexibility and control over discount configurations when setting up multi-purchase promotions, such as Buy One, Get One (BOGO), compared to Multibuy Discount target. Previously, with Multibuy discount target, you could only create a percentage-off discount and you could not repeat the discounts and apply them in the same order.
Changes:
- [API] Added CartDiscountPatternTarget, PatternComponent, CountOnLineItemUnits, and CountOnCustomLineItemUnits to the Cart Discounts API.
- [API] Added ChangeTargetPatternChangeValue to the Change History API.
- [API] Added
applicationMode
field to CartDiscountValueFixed and CartDiscountValueFixedDraft - [GraphQL API] Added the following types to the GraphQL schema:
CartDiscountPatternTarget
,CartDiscountPatternTargetInput
,PatternComponent
,PatternComponentInput
,CountOnLineItemUnits
,CountOnLineItemUnitsInput
,CountOnCustomLineItemUnits
,CountOnCustomLineItemUnitsInput
,FixedPriceCartDiscountValue
,FixedPriceCartDiscountValueInput
. - [GraphQL API] Added
pattern
input field to theCartDiscountTargetInput
type. - [GraphQL API] Added
fixedCart
input field to theFixedPriceCartDiscountValueInput
type.
The following changes were introduced in terms of GraphQL SDL:
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type CartDiscountPatternTarget implements CartDiscountTarget {
triggerPattern: [PatternComponent!]!
targetPattern: [PatternComponent!]!
maxOccurrence: Int
selectionMode: SelectionMode!
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input CartDiscountPatternTargetInput {
triggerPattern: [PatternComponentInput!]!
targetPattern: [PatternComponentInput!]!
maxOccurrence: Int
selectionMode: SelectionMode
}
extend input CartDiscountTargetInput {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
pattern: CartDiscountPatternTargetInput
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type CountOnCustomLineItemUnits implements PatternComponent {
predicate: String!
minCount: Int
maxCount: Int
excludeCount: Int
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input CountOnCustomLineItemUnitsInput @ignoreDraftConventionValidation {
predicate: String!
minCount: Int = 1
maxCount: Int
excludeCount: Int
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type CountOnLineItemUnits implements PatternComponent {
predicate: String!
minCount: Int
maxCount: Int
excludeCount: Int
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input CountOnLineItemUnitsInput @ignoreDraftConventionValidation {
predicate: String!
minCount: Int = 1
maxCount: Int
excludeCount: Int
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
interface PatternComponent {
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input PatternComponentInput {
CountOnLineItemUnits: CountOnLineItemUnitsInput
CountOnCustomLineItemUnits: CountOnCustomLineItemUnitsInput
}
extend input CartDiscountValueInput {
fixedCart: FixedPriceCartDiscountValueInput
}
type FixedPriceCartDiscountValue implements CartDiscountValue {
type: String!
money: [BaseMoney!]!
applicationMode: DiscountApplicationMode!
}
input FixedPriceCartDiscountValueInput {
money: [CartDiscountValueBaseMoneyInput!]!
applicationMode: DiscountApplicationMode!
}