12 December 2022
Pricing and DiscountsGraphQL
In addition to identifying Embedded Prices by their 
id, you can now use key as a user-defined unique identifier. By assigning a human-readable key to Embedded Prices, you have greater flexibility for referencing Embedded Prices.The 
key field was already available for StandalonePrices and this allowed us to assess and confirm its usefulness. Implementing the key field in Embedded Prices ensures consistency in offerings for both Standalone Prices and Embedded Prices.Update actions for setting the 
key value has also been added for both Embedded Prices and Standalone Prices, allowing you to efficiently update Price keys without needing to bulk import Prices with the updated price keys.Changes:
- [API] Added 
keyfield to Price and PriceDraft. - [API] Added Set Price Key update action.
 - [API] Added Set Standalone Price Key update action.
 - [API] Added the error code DuplicatePriceKey.
 - [API] Added ProductPriceKeySet Message.
 - [API] Added StandalonePriceKeySet Message.
 - [GraphQL API] Changed the 
ProductPricetype:- Added the 
keyfield to theProductPricetype. 
 - Added the 
 - [GraphQL API] Changed the 
ProductPriceSearchtype:- Added the 
keyfield to theProductPriceSearchtype. 
 - Added the 
 - [GraphQL API] Changed the 
ProductPriceDataInputtype:- Input field 
keywas added toProductPriceDataInputtype 
 - Input field 
 - [GraphQL API] Added the following types to the GraphQL schema: 
SetProductPriceKey,SetStandalonePriceKey,StandalonePriceKeySet,ProductPriceKeySet. - [GraphQL API] Changed the 
ProductUpdateActiontype:- Input field 
setPriceKeywas added toProductUpdateActiontype 
 - Input field 
 - [GraphQL API] Changed the 
StandalonePriceUpdateActiontype:- Input field 
setKeywas added toStandalonePriceUpdateActiontype 
 - Input field 
 
The following changes were introduced in terms of GraphQL SDL:
extend type ProductPrice {
  key: String
}
extend type ProductPriceSearch {
  key: String
}
extend input ProductPriceDataInput {
  key: String
}
extend input ProductUpdateAction {
  setPriceKey: SetProductPriceKey
}
input SetProductPriceKey {
  priceId: String!
  key: String
  staged: Boolean = true
}
type ProductPriceKeySet implements MessagePayload {
  variantId: Int!
  priceId: String
  oldKey: String
  key: String
  staged: Boolean!
  type: String!
}
extend input StandalonePriceUpdateAction {
  setKey: SetStandalonePriceKey
}
input SetStandalonePriceKey {
  key: String
}
type StandalonePriceKeySet implements MessagePayload {
  key: String
  oldKey: String
  type: String!
}