Manage individual Store assortments through Product Selections.
Product Selections can be used to manage individual assortments for different sales channels. For example, if you like to run multiple brand sites, sell your products in different countries, or operate a network of brick-and-mortar stores. This feature is useful for all those cases, in which the entire product catalog needs to be segmented into assortments that fit the respective sales channel.
commercetools Composable Commerce offers two modes of Product Selections specifying a subset of your Project's product catalog. In both modes, you specify each Product individually, but you either include the Products or exclude them explicitly, whichever is more convenient for you.
-
Individual: each Product that should be part of the Product Selection is added explicitly.
-
IndividualExclusion: each Product that should not be part of the Product Selection is excluded explicitly.
The following diagram shows the relationship of the Product Selection entity to other entities on the Composable Commerce APIs.

Our recommended workflow when using Product Selections is the following:
- create initial set of Products with their Variants.
- create Product Selections.
- assign Products and optionally Product Variants to the Product Selections.
In case you have product assortments that are shared among Stores like

we recommend creating a separate, shared Product Selection for the Products that the Stores have in common:

Representations
ProductSelection
id ​String​ | Unique identifier of the ProductSelection. |
version ​Int​ | Current version of the ProductSelection. |
key ​String​ | User-defined unique identifier of the ProductSelection. |
name ​ | Name of the ProductSelection. |
productCount ​Int​ | Number of Products that are currently assigned to this ProductSelection. |
mode ​ | Specifies in which way the Products are assigned to the ProductSelection.
Currently, the only way of doing this is to specify each Product individually, either by including or excluding them explicitly. Default: Individual ​ |
custom ​CustomFields​ | Custom Fields of the ProductSelection. |
createdAt ​DateTime​ | Date and time (UTC) the ProductSelection was initially created. |
createdBy ​CreatedBy​ | Present on resources created after 1/02/2019 except for events not tracked. |
lastModifiedAt ​DateTime​ | Date and time (UTC) the ProductSelection was last updated. |
lastModifiedBy ​ | Present on resources updated after 1/02/2019 except for events not tracked. |
ProductSelectionDraft
key ​String​ | User-defined unique identifier for the ProductSelection. |
name ​ | Name of the ProductSelection. Not checked for uniqueness, but distinct names are recommended. |
mode ​ | Mode of the Product Selection. Default:ÂIndividual ​ |
custom ​ | Custom Fields of this ProductSelection. |
ProductSelectionPagedQueryResponse
limit ​Int​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset ​Int​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
count ​Int​ | Actual number of results returned. |
total ​Int​ | Total number of results matching the query.
This number is an estimation that is not strongly consistent.
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false .
When the results are filtered with a Query Predicate, total is subject to a limit. |
results ​Array of ProductSelection​ | ProductSelections matching the query. |
ProductSelectionReference
id ​String​ | Unique identifier of the referenced ProductSelection. |
typeId ​ | product-selection Type of referenced resource. |
obj ​ | Contains the representation of the expanded ProductSelection. Only present in responses to requests with Reference Expansion for ProductSelections. |
ProductSelectionResourceIdentifier
id
or key
is required. If both are set, an InvalidJsonInput error is returned.id ​String​ | Unique identifier of the referenced ProductSelection. Required if key is absent. |
key ​String​ | User-defined unique identifier of the referenced ProductSelection. Required if id is absent. |
typeId ​ | product-selection Type of referenced resource. If given, it must match the expected ReferenceTypeId of the referenced resource. |
ProductSelectionMode
Product Selections can have the following modes:
Individual
- For this mode of Product Selection, the Products are to be assigned individually by using the Add Product update action.
IndividualExclusion
- Defines the Product Selection to contain Products that are excluded from the catalog. For this mode of Product Selection, the Products are to be excluded individually by using the Exclude Product update action.
ProductSelectionProductPagedQueryResponse
limit ​Int​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset ​Int​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
count ​Int​ | Actual number of results returned. |
total ​Int​ | Total number of results matching the query.
Present only when the withTotal query parameter is set to true .
This number is an estimation that is not strongly consistent.
When the results are filtered with a Query Predicate, total is subject to a limit. |
results ​Array of AssignedProductReference​ | References to Products that are assigned to the ProductSelection. |
ProductsInStorePagedQueryResponse
limit ​Int​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset ​Int​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
count ​Int​ | Actual number of results returned. |
total ​Int​ | Total number of results matching the query.
Present only when the withTotal query parameter is set to true .
This number is an estimation that is not strongly consistent.
When the results are filtered with a Query Predicate, total is subject to a limit. |
results ​Array of ProductSelectionAssignment​ | ProductSelectionAssignments matching the query. |
ProductSelectionAssignment
Specifies which Product is assigned to which ProductSelection.
variantSelection
of the ProductSelectionAssignment is deleted in such case, meaning that all SKUs of the respective Product are included then.Given the mode of Product Selection, this assignment refers to, it may contain:
variantSelection
field for a Product Selection withIndividual
ProductSelectionMode.variantExclusion
field for a Product Selection withIndividualExclusion
ProductSelectionMode.
product ​ | Reference to a Product that is assigned to the ProductSelection. |
productSelection ​ | Reference to the Product Selection that this assignment is part of. |
variantSelection ​ | Defines which particular Variants of the Product are included in the Product Selection. If undefined all Variants of the referenced Product are included. This field is only available for assignments to a Product Selection with Individual ProductSelectionMode.
The list of SKUs will be updated automatically on any change of those performed on the respective Product itself. |
variantExclusion ​ | Defines which particular Variants of the Product are excluded from the Product Selection. If undefined all Variants of the referenced Product are excluded. This field is only available for assignments to a Product Selection with IndividualExclusion ProductSelectionMode.
The list of SKUs will be updated automatically on any change of those performed on the respective Product itself. |
AssignedProductSelection
productSelection ​ | Reference to the Product Selection that this assignment is part of. |
variantSelection ​ | Defines which Variants of the Product will be included in the Product Selection. This field is only available for assignments to a Product Selection with Individual ProductSelectionMode. |
variantExclusion ​ | Defines which Variants of the Product will be excluded from the Product Selection. This field is only available for assignments to a Product Selection with IndividualExclusion ProductSelectionMode. |
createdAt ​DateTime​ | Date and time (UTC) this assignment was initially created. |
AssignedProductSelectionPagedQueryResponse
limit ​Int​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset ​Int​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
count ​Int​ | Actual number of results returned. |
total ​Int​ | Total number of results matching the query.
Present only when the withTotal query parameter is set to true .
This number is an estimation that is not strongly consistent.
When the results are filtered with a Query Predicate, total is subject to a limit. |
results ​Array of AssignedProductSelection​ | References to ProductSelection that are assigned to the Product. |
AssignedProductReference
product ​ | Reference to a Product that is assigned to the Product Selection. |
variantSelection ​ | The Variants of the Product that are included from the Product Selection. This field may exist only in Product Selections with Individual ProductSelectionMode.
In absence of this field, all Variants are deemed to be included. |
variantExclusion ​ | The Variants of the Product that are excluded from the Product Selection. This field may exist only in Product Selections with IndividualExclusion ProductSelectionMode.
In absence of this field, all Variants are deemed to be excluded. |
ProductVariantSelection
skus
field of the ProductVariantSelection automatically, making sure no ProductSelectionAssignment contains any outdated SKU.ProductVariantSelection IncludeOnly
Only Product Variants with explicitly stated SKUs are part of the Product Selection.
type ​ProductVariantSelectionTypeEnum​ | includeOnly |
skus ​Array of String​ | Non-empty array of SKUs representing Product Variants to be included into the Product Selection. |
ProductVariantSelection IncludeAllExcept
All Product Variants except the explicitly stated SKUs are part of the Product Selection.
type ​ProductVariantSelectionTypeEnum​ | includeAllExcept |
skus ​Array of String​ | Non-empty array of SKUs representing Product Variants to be excluded from the Product Selection. |
ProductVariantExclusion
IndividualExclusion
ProductSelectionMode.skus ​Array of String​ | Non-empty array of SKUs representing Product Variants to be included in the Product Selection with IndividualExclusion ProductSelectionMode. |
Get ProductSelection
Get ProductSelection by ID
view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the ProductSelection. |
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/product-selections/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"mode": "Individual",
"id": "dbd58c4a-7b2c-4b45-8134-c95bfd322d05",
"version": 1,
"createdAt": "2021-06-27T10:12:16.154Z",
"lastModifiedAt": "2021-06-27T10:12:16.154Z",
"lastModifiedBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"createdBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"key": "finest-selection",
"name": {
"en": "Finest Selection"
},
"custom": {
"type": {
"typeId": "type",
"id": "3ae9bcca-df23-443e-bd22-0c592f9694fa"
},
"fields": {
"description": "my description"
}
},
"productCount": 909
}
Get ProductSelection by Key
view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the ProductSelection. |
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/product-selections/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"mode": "Individual",
"id": "dbd58c4a-7b2c-4b45-8134-c95bfd322d05",
"version": 1,
"createdAt": "2021-06-27T10:12:16.154Z",
"lastModifiedAt": "2021-06-27T10:12:16.154Z",
"lastModifiedBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"createdBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"key": "finest-selection",
"name": {
"en": "Finest Selection"
},
"custom": {
"type": {
"typeId": "type",
"id": "3ae9bcca-df23-443e-bd22-0c592f9694fa"
},
"fields": {
"description": "my description"
}
},
"productCount": 909
}
Query ProductSelections
view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limit Int ​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset Int ​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
withTotal Boolean ​ | Controls the calculation of the total number of query results. Set to false to improve query performance when the total is not needed.Default: true ​ |
var.<varName> String ​ | Predicate parameter values. The parameter can be passed multiple times. |
ProductSelectionPagedQueryResponse
asapplication/json
curl --get https://api.{region}.commercetools.com/{projectKey}/product-selections -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"limit": 20,
"offset": 0,
"count": 2,
"total": 2,
"results": [
{
"mode": "Individual",
"id": "4b984295-82e7-4404-aa68-467a12f10ba9",
"version": 5,
"createdAt": "2021-06-23T09:33:21.010Z",
"lastModifiedAt": "2021-06-24T12:07:21.326Z",
"lastModifiedBy": {
"isPlatformClient": true,
"user": {
"typeId": "user",
"id": "4cd2cb89-7d23-4306-87a4-1d8b0db3845d"
}
},
"createdBy": {
"isPlatformClient": true,
"user": {
"typeId": "user",
"id": "4cd2cb89-7d23-4306-87a4-1d8b0db3845d"
}
},
"key": "my-selection",
"name": {
"en": "My Product Selection"
},
"custom": {
"type": {
"typeId": "type",
"id": "3ae9bcca-df23-443e-bd22-0c592f9694fa"
},
"fields": {
"description": "my description"
}
},
"productCount": 0
},
{
"mode": "Individual",
"id": "dbd58c4a-7b2c-4b45-8134-c95bfd322d05",
"version": 1,
"createdAt": "2021-06-27T10:12:16.154Z",
"lastModifiedAt": "2021-06-27T10:12:16.154Z",
"lastModifiedBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"createdBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"key": "finest-selection",
"name": {
"en": "Finest Selection"
},
"productCount": 1
}
]
}
Query Products assigned to a ProductSelection
by ProductSelection ID
total
field.
To get total
included, pass the query parameter withTotal
set to true
.view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the ProductSelection. |
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limit Int ​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset Int ​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
withTotal Boolean ​ |
ProductSelectionProductPagedQueryResponse
asapplication/json
curl --get https://api.{region}.commercetools.com/{projectKey}/product-selections/{id}/products -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"limit": 20,
"offset": 0,
"count": 2,
"results": [
{
"product": {
"typeId": "product",
"id": "72dcfd13-92e8-4fa1-bd01-926a646bfb30"
},
"variantSelection": {
"type": "includeOnly",
"skus": ["M0E20000000E1PI"]
}
},
{
"product": {
"typeId": "product",
"id": "2a38796b-0bb1-4a4f-8b0d-bf6e8f6661a7"
},
"variantSelection": {
"type": "includeOnly",
"skus": ["M0E20000000E1PJ"]
}
}
]
}
by ProductSelection Key
total
field.
To get total
included, pass the query parameter withTotal
set to true
.view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the ProductSelection. |
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limit Int ​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset Int ​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
withTotal Boolean ​ |
ProductSelectionProductPagedQueryResponse
asapplication/json
curl --get https://api.{region}.commercetools.com/{projectKey}/product-selections/key={key}/products -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"limit": 20,
"offset": 0,
"count": 2,
"results": [
{
"product": {
"typeId": "product",
"id": "72dcfd13-92e8-4fa1-bd01-926a646bfb30"
},
"variantSelection": {
"type": "includeOnly",
"skus": ["M0E20000000E1PI"]
}
},
{
"product": {
"typeId": "product",
"id": "2a38796b-0bb1-4a4f-8b0d-bf6e8f6661a7"
},
"variantSelection": {
"type": "includeOnly",
"skus": ["M0E20000000E1PJ"]
}
}
]
}
Query Products assigned to active ProductSelections in a Store
The response will include duplicate Products whenever more than one active Product Selection of the Store includes a Product. To make clear through which Product Selection a Product is available in the Store the response contains assignments including both the Product and the Product Selection. Only Products of Product Selections that are activated in the Store will be returned.
view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
where | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limit Int ​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset Int ​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
withTotal Boolean ​ | |
var.<varName> String ​ | Predicate parameter values. The parameter can be passed multiple times. |
ProductsInStorePagedQueryResponse
asapplication/json
curl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/product-selection-assignments -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"limit": 20,
"offset": 0,
"count": 1,
"results": [
{
"productSelection": {
"id": "3a914b5c-4b87-42ce-998c-91e5aa7a329f",
"typeId": "product-selection"
},
"product": {
"id": "d1c99e83-b9d4-48b2-9441-108c2a47009b",
"typeId": "product"
}
}
]
}
Check if ProductSelection exists
Check if ProductSelection exists by ID
id
. Returns a 200 OK
status if the ProductSelection exists or a 404 Not Found
otherwise.view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the ProductSelection. |
curl --head https://api.{region}.commercetools.com/{projectKey}/product-selections/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if ProductSelection exists by Key
key
. Returns a 200 OK
status if the ProductSelection exists or a 404 Not Found
otherwise.view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the ProductSelection. |
curl --head https://api.{region}.commercetools.com/{projectKey}/product-selections/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if ProductSelection exists by Query Predicate
200 OK
status if any ProductSelections match the query predicate, or a 404 Not Found
otherwise.view_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/product-selections -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Create ProductSelection
manage_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
expand | The parameter can be passed multiple times. |
application/json
application/json
curl https://api.{region}.commercetools.com/{projectKey}/product-selections -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"key" : "finest-selection",
"name" : {
"en" : "Finest Selection"
}
}
DATA
{
"mode": "Individual",
"id": "dbd58c4a-7b2c-4b45-8134-c95bfd322d05",
"version": 1,
"createdAt": "2021-06-27T10:12:16.154Z",
"lastModifiedAt": "2021-06-27T10:12:16.154Z",
"lastModifiedBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"createdBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"key": "finest-selection",
"name": {
"en": "Finest Selection"
},
"custom": {
"type": {
"typeId": "type",
"id": "3ae9bcca-df23-443e-bd22-0c592f9694fa"
},
"fields": {
"description": "my description"
}
},
"productCount": 909
}
Update ProductSelection
Update ProductSelection by ID
manage_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the ProductSelection. |
expand | The parameter can be passed multiple times. |
application/json
version ​Int​ | |
actions ​Array of ProductSelectionUpdateAction​ |
application/json
curl https://api.{region}.commercetools.com/{projectKey}/product-selections/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : {
"en" : "new selection name"
}
} ]
}
DATA
{
"mode": "Individual",
"id": "dbd58c4a-7b2c-4b45-8134-c95bfd322d05",
"version": 1,
"createdAt": "2021-06-27T10:12:16.154Z",
"lastModifiedAt": "2021-06-27T10:12:16.154Z",
"lastModifiedBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"createdBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"key": "finest-selection",
"name": {
"en": "Finest Selection"
},
"custom": {
"type": {
"typeId": "type",
"id": "3ae9bcca-df23-443e-bd22-0c592f9694fa"
},
"fields": {
"description": "my description"
}
},
"productCount": 909
}
Update ProductSelection by Key
manage_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the ProductSelection. |
expand | The parameter can be passed multiple times. |
application/json
version ​Int​ | |
actions ​Array of ProductSelectionUpdateAction​ |
application/json
curl https://api.{region}.commercetools.com/{projectKey}/product-selections/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : {
"en" : "new selection name"
}
} ]
}
DATA
{
"mode": "Individual",
"id": "dbd58c4a-7b2c-4b45-8134-c95bfd322d05",
"version": 1,
"createdAt": "2021-06-27T10:12:16.154Z",
"lastModifiedAt": "2021-06-27T10:12:16.154Z",
"lastModifiedBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"createdBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"key": "finest-selection",
"name": {
"en": "Finest Selection"
},
"custom": {
"type": {
"typeId": "type",
"id": "3ae9bcca-df23-443e-bd22-0c592f9694fa"
},
"fields": {
"description": "my description"
}
},
"productCount": 909
}
Update actions
Add Product
Individual
ProductSelectionMode.Adds a Product to the Product Selection.
action ​String​ | "addProduct" |
product ​ | ResourceIdentifier of the Product |
variantSelection ​ | Defines which Variants of the Product will be included in the Product Selection. If not supplied all Variants are deemed to be included. |
{
"action": "addProduct",
"product": {
"typeId": "product",
"key": "millennium-falcon"
},
"variantSelection": {
"type": "includeOnly",
"skus": [
"metallic-white"
]
}
}
Exclude Product
IndividualExclusion
ProductSelectionMode.IndividualExclusion
ProductSelectionMode.action ​String​ | "excludeProduct" |
product ​ | ResourceIdentifier of the Product |
variantExclusion ​ | Defines which Variants of the Product will be excluded from the Product Selection. If not supplied all Variants are deemed to be excluded. |
{
"action": "excludeProduct",
"product": {
"typeId": "product",
"key": "millennium-falcon"
},
"variantExclusion": {
"skus": [
"metallic-white"
]
}
}
Set Variant Selection
Individual
ProductSelectionMode.Individual
ProductSelectionMode.action ​String​ | "setVariantSelection" |
product ​ | ResourceIdentifier of the Product |
variantSelection ​ | Determines which Variants of the previously added Product are to be included in, or excluded from, the Product Selection. Leave it empty to unset an existing Variant Selection. |
{
"action": "setVariantSelection",
"product": {
"typeId": "product",
"key": "millennium-falcon"
},
"variantSelection": {
"type": "includeOnly",
"skus": [
"M0E20000000EH3V"
]
}
}
Set Variant Exclusion
IndividualExclusion
ProductSelectionMode.IndividualExclusion
ProductSelectionMode.action ​String​ | "setVariantExclusion" |
product ​ | ResourceIdentifier of the Product |
variantExclusion ​ | Determines which Variants of the previously excluded Product are to be included in the Product Selection with IndividualExclusion ProductSelectionMode.
Leave it empty to unset an existing Variant Exclusion. |
{
"action": "setVariantExclusion",
"product": {
"typeId": "product",
"key": "millennium-falcon"
},
"variantExclusion": {
"skus": [
"M0E20000000EH3V",
"M0E20000000EH4Q",
"M0E20000000EH5J"
]
}
}
Remove Product
action ​String​ | "removeProduct" |
product ​ | ResourceIdentifier of the Product |
{
"action": "removeProduct",
"product": {
"typeId": "product",
"key": "millennium-falcon"
}
}
Set Key
action ​String​ | "setKey" |
key ​String​ | If key is absent or null , the existing key, if any, will be removed. |
{
"action": "setKey",
"key": "ProductSelectionKey"
}
Change Name
action ​String​ | "changeName" |
name ​ | The new name to be set for the ProductSelection. |
{
"action": "changeName",
"name": {
"en": "My Product Selection",
"de": "Meine Product Selection"
}
}
Set Custom Type
action ​String​ | "setCustomType" |
type ​ | Defines the Type that extends the ProductSelection with Custom Fields.
If absent, any existing Type and Custom Fields are removed from the ProductSelection. |
fields ​ | Sets the Custom Fields fields for the ProductSelection. |
{
"action": "setCustomType",
"type": {
"id": "{{type-id}}",
"typeId": "type"
},
"fields": {
"exampleStringField": "TextString"
}
}
Set CustomField
action ​String​ | "setCustomField" |
name ​String​ | Name of the Custom Field. |
value ​ | If value is absent or null , this field will be removed if it exists.
Removing a field that does not exist returns an InvalidOperation error.
If value is provided, it is set for the field defined by name . |
{
"action": "setCustomField",
"name": "exampleStringField",
"value": "TextString"
}
Delete ProductSelection
Delete ProductSelection by ID
manage_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the ProductSelection. |
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/product-selections/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"mode": "Individual",
"id": "dbd58c4a-7b2c-4b45-8134-c95bfd322d05",
"version": 1,
"createdAt": "2021-06-27T10:12:16.154Z",
"lastModifiedAt": "2021-06-27T10:12:16.154Z",
"lastModifiedBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"createdBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"key": "finest-selection",
"name": {
"en": "Finest Selection"
},
"custom": {
"type": {
"typeId": "type",
"id": "3ae9bcca-df23-443e-bd22-0c592f9694fa"
},
"fields": {
"description": "my description"
}
},
"productCount": 909
}
Delete ProductSelection by Key
manage_product_selections:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the ProductSelection. |
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/product-selections/key={key}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"mode": "Individual",
"id": "dbd58c4a-7b2c-4b45-8134-c95bfd322d05",
"version": 1,
"createdAt": "2021-06-27T10:12:16.154Z",
"lastModifiedAt": "2021-06-27T10:12:16.154Z",
"lastModifiedBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"createdBy": {
"clientId": "gqjDgvivRSfJ4fCrk6Lu3j7x",
"isPlatformClient": false
},
"key": "finest-selection",
"name": {
"en": "Finest Selection"
},
"custom": {
"type": {
"typeId": "type",
"id": "3ae9bcca-df23-443e-bd22-0c592f9694fa"
},
"fields": {
"description": "my description"
}
},
"productCount": 909
}