All Release Notes

Introduced Store-specific Cart Discounts in beta

5 July 2023
Enhancement
Pricing and DiscountsStoresSecurity

With the introduction of Store-specific Cart Discounts in public beta, you can now define Cart Discounts that are applicable to specific Stores. Previously, you could only define Cart Discounts that are active across all the Stores in your Project.

You can restrict the permissions of API Clients to view and manage Cart Discounts in a specific Store only. Previously, such permissions could only be managed globally for all Cart Discounts in a Project at the same time. However, the permissions set are not exclusive in the following instances:

  • Cart Discounts requiring a Discount Code can be linked to a Discount Code created by any user.
  • When using Custom Fields, if any Custom Field references Cart Discounts, all Cart Discounts will be visible.

With this enhancement, the limit for Cart Discounts that do not require a Discount Code has been increased. In addition to the 100 active Cart Discounts that are independent of a Store, you can now have 100 Cart Discounts per Store. Thus, the overall limit is 100 + (100 * number of Stores in a Project).

Changes:

  • [API] Added manage_cart_discounts:{projectKey}:{store_key} scope and view_cart_discounts:{projectKey}:{store_key} scope.

  • [API] Added stores field to CartDiscount and CartDiscountDraft.

  • [API] Added Add Store, Remove Store, and Set Stores update actions to the Cart Discounts API.

  • [API] Added Get, Query, Create, Update, and Delete CartDiscount in Store endpoints.

  • [API] Added MaxCartDiscountsReached, StoreCartDiscountsLimitReached, and MaxStoreReferencesReached errors.

  • [GraphQL API] Added the following types to the GraphQL schema: AddCartDiscountStore, RemoveCartDiscountStore, SetCartDiscountStores

  • [GraphQL API] Changed the CartDiscountDraft type:

    • Input field stores was added to CartDiscountDraft type
  • [GraphQL API] Changed the InStore type:

    • InStore object type now implements CartDiscountQueryInterface interface
    • Added the cartDiscounts field to the InStore type.
    • Added the cartDiscount field to the InStore type.
  • [GraphQL API] Changed the CartDiscount type:

    • Added the stores field to the CartDiscount type.
    • Added the storesRef field to the CartDiscount type.
  • [GraphQL API] Changed the CartDiscountUpdateAction type:

    • Input field setStores was added to CartDiscountUpdateAction type
    • Input field removeStore was added to CartDiscountUpdateAction type
    • Input field addStore was added to CartDiscountUpdateAction type

The following changes were introduced in terms of GraphQL SDL:

extend type InStore {
cartDiscount(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): CartDiscount
cartDiscounts(where: String, sort: [String!], limit: Int, offset: Int): CartDiscountQueryResult!
}
extend type CartDiscount {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
stores: [Store!]!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
storesRef: [KeyReference!]!
}
extend input CartDiscountDraft {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
stores: [ResourceIdentifierInput!]
}
extend input CartDiscountUpdateAction {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
addStore: AddCartDiscountStore
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
removeStore: RemoveCartDiscountStore
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
setStores: SetCartDiscountStores
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input AddCartDiscountStore {
store: ResourceIdentifierInput!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input RemoveCartDiscountStore {
store: ResourceIdentifierInput!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input SetCartDiscountStores {
stores: [ResourceIdentifierInput!]
}