Introduced Store-specific Cart Discounts in beta
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 andview_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 toCartDiscountDraft
type
- Input field
[GraphQL API] Changed the
InStore
type:InStore
object type now implementsCartDiscountQueryInterface
interface- Added the
cartDiscounts
field to theInStore
type. - Added the
cartDiscount
field to theInStore
type.
[GraphQL API] Changed the
CartDiscount
type:- Added the
stores
field to theCartDiscount
type. - Added the
storesRef
field to theCartDiscount
type.
- Added the
[GraphQL API] Changed the
CartDiscountUpdateAction
type:- Input field
setStores
was added toCartDiscountUpdateAction
type - Input field
removeStore
was added toCartDiscountUpdateAction
type - Input field
addStore
was added toCartDiscountUpdateAction
type
- Input field
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): CartDiscountcartDiscounts(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!]}