Standalone Prices
A Standalone Price assigns a Price to a Product Variant for a given scope.
The Standalone Prices API provides an alternative way to store your product prices as standalone resources. In comparison to Prices embedded inside the Product, this approach allows going beyond the limit of 100 prices per ProductVariant. It also brings a more flexible way to query and manage your Prices, separately from your Products, which contributes to better query performance.
The differences between the two approaches are explained below:
StandalonePrices are managed and queried through the StandalonePrices API and associated to a ProductVariant through the
skufield. Through the API endpoint, you can create, update and delete prices, as well as query or fetch them by ID or by Key. It enables storing up to 50 000 Prices per ProductVariant.Embedded Prices are located inside the
pricesfield of the ProductVariant to which they are associated, therefore they are managed and queried through the Product API endpoint. You can add prices when creating a Product or manage the prices of an existing Product using the update actions addPrice, setPrices, changePrice, and removePrice. It has a limit of 100 prices per ProductVariant.Embedded Prices can have staged changes stored in the staged representation of the Product information. StandalonePrices support staged changes via the concept of StagedStandalonePrice.
To specify where the Prices of a particular Product are located, you need to set the ProductPriceMode accordingly. You can set the priceMode field on the ProductDraft when creating a Product or afterwards by the Set PriceMode update action. When priceMode is not set, the API treats the Product as having the Embedded ProductPriceMode.
A Product can have Embedded Prices as well as Standalone Prices at the same time, but the priceMode on a Product determines which Price the API uses for LineItem Price selection and Product Price Selection.
Representations
StandalonePrice
idString | Unique identifier of the StandalonePrice. |
versionInt | Current version of the StandalonePrice. |
keyString | User-defined unique identifier of the StandalonePrice. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
skuString | SKU of the ProductVariant to which this Price is associated. |
value | Money value of this Price. |
country | Country for which this Price is valid. Pattern:^[A-Z]{2}$ |
customerGroup | CustomerGroup for which this Price is valid. |
channel | Product distribution Channel for which this Price is valid. |
validFrom | Date from which the Price is valid. |
validUntil | Date until the Price is valid. |
tiersArray of PriceTier | Price tiers if any are defined. |
discounted | Set if a matching ProductDiscount exists. If set, the API uses the |
stagedBETA | Staged changes of the StandalonePrice. Only present if the StandalonePrice has staged changes. |
activeBETABoolean | If set to true |
custom | Custom Fields for the StandalonePrice. |
createdAt | Date and time (UTC) the StandalonePrice was initially created. |
createdByBETA | Present on resources created after 1 February 2019 except for events not tracked. |
lastModifiedAt | Date and time (UTC) the StandalonePrice was last updated. |
lastModifiedByBETA | Present on resources created after 1 February 2019 except for events not tracked. |
StandalonePriceDraft
Standalone Prices are defined with a scope consisting of currency and optionally country, customerGroup, and channel and/or a validity period (validFrom and/or validTo). For more information see price selection.
Creating a Standalone Price is rejected if there already exists a Standalone Price for the same SKU with exactly the same price scope, or with overlapping validity periods within the same price scope. A Price without validity period does not conflict with a Price defined for a time period.
keyString | User-defined unique identifier for the StandalonePrice. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
skuString | Specifies to which ProductVariant the API associates this Price. It is not validated to exist in product variants. |
value | Sets the money value of this Price. |
country | Sets the country for which this Price is valid. Pattern:^[A-Z]{2}$ |
customerGroup | Sets the CustomerGroup for which this Price is valid. |
channel | Sets the product distribution Channel for which this Price is valid. |
validFrom | Sets the date from which the Price is valid. Must be at least 1 ms earlier than |
validUntil | Sets the date until the Price is valid. Must be at least 1 ms later than |
tiersArray of PriceTierDraft | Sets price tiers. |
discounted | Sets a discounted price for this Price that is different from the base price with |
activeBETABoolean | If set to true |
custom | Custom Fields for the StandalonePrice. |
StandalonePricePagedQueryResponse
limitInt | Number of requested results. |
offsetInt | Offset supplied by the client or server default. It is the number of elements skipped, not a page number. |
countInt | Actual number of results returned. |
totalInt | 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 |
resultsArray of StandalonePrice | StandalonePrices matching the query. |
StandalonePriceReference
Reference to a StandalonePrice.
idString | Unique ID of the referenced resource. |
typeIdString | "standalone-price"References a StandalonePrice. |
obj | Contains the representation of the expanded StandalonePrice. Only present in responses to requests with Reference Expansion for StandalonePrice. |
StandalonePriceResourceIdentifier
idString | Unique identifier of the referenced resource. Required if |
keyString | User-defined unique identifier of the referenced resource. Required if |
typeIdString | "standalone-price"References a StandalonePrice. |
StagedStandalonePrice BETA
Staged changes on a Standalone Price. To update the value property of a Staged Standalone Price, use the corresponding update action. To apply all staged changes to the Standalone Price, use the applyStagedChanges update action.
value | Money value of the StagedStandalonePrice. |
discounted | Discounted price for the StagedStandalonePrice. |
Get StandalonePrice
Get StandalonePrice by ID
view_standalone_prices:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
curl -X GET https://api.{region}.commercetools.com/{projectKey}/standalone-prices/{id} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
{"id" : "3f8812c6-88e8-11ec-a8a3-0242ac120002","version" : 1,"sku" : "PT974SKT","value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 10000,"fractionDigits" : 2},"active" : true,"createdAt" : "2022-05-09T08:29:13.253Z","lastModifiedAt" : "2022-05-09T12:36:55.401Z"}
Get StandalonePrice by Key
view_standalone_prices:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
curl -X GET https://api.{region}.commercetools.com/{projectKey}/standalone-prices/key={key} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
{"id" : "3f8812c6-88e8-11ec-a8a3-0242ac120002","version" : 1,"sku" : "PT974SKT","value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 10000,"fractionDigits" : 2},"active" : true,"createdAt" : "2022-05-09T08:29:13.253Z","lastModifiedAt" : "2022-05-09T12:36:55.401Z"}
Query StandalonePrices
view_standalone_prices:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
where | The parameter can be passed multiple times. |
/^var[.][a-zA-Z0-9]+$/Any string parameter matching this regular expression | Predicate parameter values. The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limitInt | Number of results requested. |
offsetInt | Number of elements skipped. |
withTotalBoolean | Controls the calculation of the total number of query results. Set to |
curl -X GET https://api.{region}.commercetools.com/{projectKey}/standalone-prices -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
{"limit" : 20,"offset" : 0,"count" : 2,"total" : 2,"results" : [ {"id" : "3f8812c6-88e8-11ec-a8a3-0242ac120002","version" : 1,"sku" : "PT974SKT","value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 10000,"fractionDigits" : 2},"active" : true,"createdAt" : "2022-05-09T08:29:13.253Z","lastModifiedAt" : "2022-05-09T12:36:55.401Z"}, {"id" : "9d73608c-88ea-11ec-a8a3-0242ac120002","version" : 1,"key" : "random-key-12345","sku" : "PT562ZTB","value" : {"type" : "centPrecision","currencyCode" : "USD","centAmount" : 15000,"fractionDigits" : 2},"country" : "DE","channel" : {"typeId" : "channel","id" : "2ae21284-88ea-11ec-a8a3-0242ac120002"},"customerGroup" : {"typeId" : "customer-group","id" : "15a1678a-88ea-11ec-a8a3-0242ac120002"},"active" : true,"createdAt" : "2022-05-09T09:29:13.253Z","lastModifiedAt" : "2022-05-09T10:36:55.401Z"} ]}
Create StandalonePrice
Produces the StandalonePriceCreated Message.
manage_standalone_prices:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
expand | The parameter can be passed multiple times. |
curl -X POST https://api.{region}.commercetools.com/{projectKey}/standalone-prices -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"sku" : "PT974SKT","value" : {"currencyCode" : "EUR","centAmount" : 10000}}DATA
{"id" : "3f8812c6-88e8-11ec-a8a3-0242ac120002","version" : 1,"sku" : "PT974SKT","value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 10000,"fractionDigits" : 2},"active" : true,"createdAt" : "2022-05-09T08:29:13.253Z","lastModifiedAt" : "2022-05-09T12:36:55.401Z"}
Update StandalonePrice
Update StandalonePrice by ID
manage_standalone_prices:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
versionInt | Expected version of the StandalonePrice on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict error will be returned. |
actionsArray of StandalonePriceUpdateAction | Update actions to be performed on the StandalonePrice. |
curl -X POST https://api.{region}.commercetools.com/{projectKey}/standalone-prices/{id} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"version" : 1,"actions" : [ {"action" : "changeValue","value" : {"currencyCode" : "EUR","centAmount" : 10000}} ]}DATA
{"id" : "3f8812c6-88e8-11ec-a8a3-0242ac120002","version" : 1,"sku" : "PT974SKT","value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 10000,"fractionDigits" : 2},"active" : true,"createdAt" : "2022-05-09T08:29:13.253Z","lastModifiedAt" : "2022-05-09T12:36:55.401Z"}
Update StandalonePrice by Key
manage_standalone_prices:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
versionInt | Expected version of the StandalonePrice on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict error will be returned. |
actionsArray of StandalonePriceUpdateAction | Update actions to be performed on the StandalonePrice. |
curl -X POST https://api.{region}.commercetools.com/{projectKey}/standalone-prices/key={key} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"version" : 1,"actions" : [ {"action" : "changeValue","value" : {"currencyCode" : "EUR","centAmount" : 10000}} ]}DATA
{"id" : "3f8812c6-88e8-11ec-a8a3-0242ac120002","version" : 1,"sku" : "PT974SKT","value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 10000,"fractionDigits" : 2},"active" : true,"createdAt" : "2022-05-09T08:29:13.253Z","lastModifiedAt" : "2022-05-09T12:36:55.401Z"}
Update actions
Change Value
Updating the value of a StandalonePrice produces the StandalonePriceValueChangedMessage.
actionString | "changeValue" |
value | New value to set. Must not be empty. |
stagedBETABoolean | If set to false |
{"action" : "changeValue","staged" : false,"value" : {"currencyCode" : "EUR","centAmount" : 10000}}
Change Active BETA
Updating the value of a StandalonePrice produces the StandalonePriceActiveChangedMessage.
actionString | "changeActive" |
activeBoolean | New value to set for the |
{"action" : "changeActive","active" : false}
Set Custom Type
actionString | "setCustomType" |
type | Defines the Type that extends the StandalonePrice with Custom Fields. If absent, any existing Type and Custom Fields are removed from the StandalonePrice. |
fields | Sets the Custom Fields fields for the StandalonePrice. |
{"action" : "setCustomType","type" : {"id" : "{{type-id}}","typeId" : "type"},"fields" : {"examplaryStringTypeField" : "TextString"}}
Set Custom Field
actionString | "setCustomField" |
nameString | Name of the Custom Field. |
value | If |
{"action" : "setCustomField","name" : "ExamplaryStringTypeField","value" : "TextString"}
Set Discounted Price
Discounts a Standalone Price. The referenced ProductDiscount in the discounted field must be of type external, active, and its predicate must match the referenced Price. Produces the StandalonePriceExternalDiscountSet Message.
actionString | "setDiscountedPrice" |
discounted | Value to set. If empty, any existing value will be removed. |
{"action" : "setDiscountedPrice","discounted" : {"value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 2990,"fractionDigits" : 2},"discount" : {"typeId" : "product-discount","id" : "{{product-discount-id}}"}}}
Apply Staged Changes BETA
Applies all staged changes to the StandalonePrice by overwriting all current values with the values in the StagedStandalonePrice. After successfully applied, the StagedStandalonePrice will be removed from the StandalonePrice. An applyStagedChanges update action on a StandalonePrice that does not contain any staged changes will return a 400 Bad Request error. Applying staged changes successfully will produce the StandalonePriceStagedChangesApplied Message.
actionString | "applyStagedChanges" |
{"action" : "applyStagedChanges"}
Delete StandalonePrice
Delete StandalonePrice by ID
Produces the StandalonePriceDeleted Message.
manage_standalone_prices:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/standalone-prices/{id}?version={version} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
{"id" : "3f8812c6-88e8-11ec-a8a3-0242ac120002","version" : 1,"sku" : "PT974SKT","value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 10000,"fractionDigits" : 2},"active" : true,"createdAt" : "2022-05-09T08:29:13.253Z","lastModifiedAt" : "2022-05-09T12:36:55.401Z"}
Delete StandalonePrice by Key
Produces the StandalonePriceDeleted Message.
manage_standalone_prices:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/standalone-prices/key={key}?version={version} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
{"id" : "3f8812c6-88e8-11ec-a8a3-0242ac120002","version" : 1,"sku" : "PT974SKT","value" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 10000,"fractionDigits" : 2},"active" : true,"createdAt" : "2022-05-09T08:29:13.253Z","lastModifiedAt" : "2022-05-09T12:36:55.401Z"}