29 June 2022
Enhancement
Product CatalogStoresMessages/SubscriptionsGraphQL

You can now include or exclude particular Product Variants in/from a Product Selection. Formerly it was only possible to add Products as a whole to a Product Selection meaning that all existing Product Variants of the Product are included.

Changes:

  • [API] You can now specify a Product Variant Selection when you Add a Product to the Product Selection.
  • [API] You can now specify a Product Variant Selection for an existing Product in the Product Selection by the new Set Variant Selection update action.
  • [API] When you query a Product Selection for Products assigned to a Product Selection the response now also contains Product Variant Selections.
  • [API] When you query for Products available in a Store through active Product Selections the response now also contains Product Variant Selections.
  • [API] When you Get Product Projection in a Store by ID or by Key you can now project by Product Selection assignments for Product Variants.
  • [API] Added variantSelection field to ProductSelectionProductAdded Message.
  • [API] Added ProductSelectionVariantSelectionChanged Message.
  • [API] Added ProductAssignmentMissing and ProductPresentWithDifferentVariantSelection errors.
  • [GraphQL API] Added the following types to the GraphQL schema: ProductSelectionVariantSelectionChanged, ProductVariantSelection, ProductVariantSelectionDraft, ProductVariantSelectionExclusion, ProductVariantSelectionInclusion, SetProductSelectionVariantSelection.
  • [GraphQL API] Changed the ProductOfSelection type:
    • Added the variantSelection field to the ProductOfSelection type.
  • [GraphQL API] Changed the SelectionOfProduct type:
    • Added the variantSelection field to the SelectionOfProduct type.
  • [GraphQL API] Changed the ProductSelectionUpdateAction type:
    • Input field setVariantSelection was added to ProductSelectionUpdateAction type
  • [GraphQL API] Changed the AddProductSelectionProduct type:
    • Input field variantSelection was added to AddProductSelectionProduct type
  • [GraphQL API] Changed the ProductSelectionProductAdded type:
    • Added the variantSelection field to the ProductSelectionProductAdded type.

The following changes were introduced in terms of GraphQL SDL:

extend type ProductOfSelection {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#beta-features"
variantSelection: ProductVariantSelection
}
extend type SelectionOfProduct {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#beta-features"
variantSelection: ProductVariantSelection
}
extend input ProductSelectionUpdateAction {
setVariantSelection: SetProductSelectionVariantSelection
}
extend input AddProductSelectionProduct {
variantSelection: ProductVariantSelectionDraft
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#beta-features"
interface ProductVariantSelection {
type: String!
skus: [String!]!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#beta-features"
input ProductVariantSelectionDraft {
inclusion: [String!]
exclusion: [String!]
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#beta-features"
type ProductVariantSelectionExclusion implements ProductVariantSelection {
type: String!
skus: [String!]!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#beta-features"
type ProductVariantSelectionInclusion implements ProductVariantSelection {
type: String!
skus: [String!]!
}
input SetProductSelectionVariantSelection {
product: ResourceIdentifierInput!
variantSelection: ProductVariantSelectionDraft
}
extend type ProductSelectionProductAdded {
variantSelection: ProductVariantSelection
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type ProductSelectionVariantSelectionChanged implements MessagePayload {
oldVariantSelection: ProductVariantSelection
newVariantSelection: ProductVariantSelection
product: Product
productRef: Reference!
type: String!
}