All Release Notes

Added support for key and Messages for Discount Codes

7 February 2024
Enhancement
Pricing and DiscountsMessages/SubscriptionsGraphQL

You can now use user-defined key values to identify Discount Codes. Previously, you could identify them only by their auto-generated IDs. The enhancement also includes a new update action to set the key value, allowing you to update Discount Code keys efficiently without the need to bulk import Discount Codes with the updated keys.

Additionally, this enhancement also adds support for Messages for Discount Codes. You can subscribe to these Messages for changes when creating, deleting, or setting a key value for a Discount Code.

Changes:

  • [API]
  • [GraphQL API]
    • Input field key was added to DiscountCode and DiscountCodeDraft type.
    • Input field setKey was added to DiscountCodeUpdateAction type.
    • Argument key was added to Query.discountCode field and changed Query.discountCode(id) from required to optional.
    • Argument key was added to Mutation.updateDiscountCode field and changed Mutation.updateDiscountCode(id) from required to optional.
    • Argument key was added to Mutation.deleteDiscountCode field that changed Mutation.deleteDiscountCode(id) from required to optional.
    • Added the following types to the GraphQL schema: SetDiscountCodeKey, DiscountCodeCreated, DiscountCodeDeleted, DiscountCodeKeySet.

The following changes were introduced in terms of GraphQL SDL:

extend type DiscountCode {
key: String
}
extend input DiscountCodeDraft {
key: String
}
extend input DiscountCodeUpdateAction {
setKey: SetDiscountCodeKey
}
input SetDiscountCodeKey {
key: String
}
extend type Query {
discountCode(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): DiscountCode
}
extend type Mutation {
updateDiscountCode(version: Long!, actions: [DiscountCodeUpdateAction!]!,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): DiscountCode
deleteDiscountCode(version: Long!,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): DiscountCode
}
type DiscountCodeCreated implements MessagePayload {
discountCode: DiscountCode!
type: String!
}
type DiscountCodeDeleted implements MessagePayload {
type: String!
}
type DiscountCodeKeySet implements MessagePayload {
key: String
oldKey: String
type: String!
}