Product Discounts

Product discounts are used to change certain product prices.

A product price can be discounted in two ways:

The discounted price is stored in the discounted field of the Product Price.

Note that when a discount is created, updated or removed it can take up to 15 minutes to update all the prices with the discounts.

ProductDiscount Predicate

The predicate offers a flexible way to define which product prices should be reduced.

Predicate Identifiers

The following field identifiers can be used in a predicate. They reference a field in a Product or a field in the Product Price.

Predicate Operators

The operators combine field identifiers with concrete values to construct predicates. The operators use the infix notation with the general notation field-identifier operator value (for example sku = "AB-123" where the field identifier is sku, the operator is = and the value is "AB-123"). Collection values are separated with , and enclosed in parentheses, for example categories.id = ("f6a19a23-14e3-40d0-aee2-3e612fcb1bc7", "abcd9a23-14e3-40d0-aee2-3e612fcbefgh").

Predicate Examples

// match a specific variant in the specific product
product.id = "f6a19a23-14e3-40d0-aee2-3e612fcb1bc7" and variant.id = 1

//match a product that is in the given category
categories.id contains "f6a19a23-14e3-40d0-aee2-3e612fcb1bc7"

//match a product that is in all of the the given categories
categories.id contains all ("f6a19a23-14e3-40d0-aee2-3e612fcb1bc7", "abcd9a23-14e3-40d0-aee2-3e612fcbefgh")

//match a product that is in one of the the given categories
categories.id contains any ("f6a19a23-14e3-40d0-aee2-3e612fcb1bc7", "abcd9a23-14e3-40d0-aee2-3e612fcbefgh")

//match a product that is in the two given categories and in no others
categories.id = ("f6a19a23-14e3-40d0-aee2-3e612fcb1bc7", "abcd9a23-14e3-40d0-aee2-3e612fcbefgh")

//match the prices above 12€ for any countries except France that do not have a customer group set
centAmount > 1200 and currency = "EUR" and country != "FR" and customerGroup.id is not defined

//match all product variants that have size "L" and have the color white and black   
//size is an EnumType attribute for which the key is specified in the predicate,
//color is a SetType of Enums for which the keys are listed in the predicate.
attributes.size = "L" and attributes.colors contains all ("black", "white")

//match all product variants with the given sku, the boolean attribute available set to true and the number attribute weight less than 100
sku = "AB-12" and attributes.available = true and attributes.weight < 100

//match all products that are in the given category or in a category that is a descendant of the given category
categoriesWithAncestors.id contains "abcd9a23-14e3-40d0-aee2-3e612fcbefgh"

Representations

ProductDiscount

ProductDiscountDraft

ProductDiscountValue

Defines discount type with the corresponding value. The type can be relative, absolute or external.

Relative

Absolute

External

The external discount is used by the setDiscountedPrice update action and enables the client to explicitly set a discounted value for a particular price.

Get ProductDiscount by ID

Endpoint: /{projectKey}/product-discounts/{id}
Method: GET
OAuth2 Scopes: view_products:{projectKey}
Response Representation: ProductDiscount

Query ProductDiscounts

Endpoint: /{projectKey}/product-discounts
Method: GET
OAuth2 Scopes: view_products:{projectKey}
Response Representation: PagedQueryResult with the results array of ProductDiscount
Query Parameters:

Create a ProductDiscount

Endpoint: /{projectKey}/product-discounts
Method: POST
OAuth2 Scopes: manage_products:{projectKey}
Request Representation: ProductDiscountDraft
Response Representation: ProductDiscount

Update ProductDiscount

Endpoint: /{projectKey}/product-discounts/{id}
Method: POST
OAuth2 Scopes: manage_products:{projectKey}
Response Representation: ProductDiscount
Fields:

Update Actions
Please find below the individual update actions provided on this endpoint.


Change Value

Change Predicate

Change Is Active

Change Name

Set Description

Change Sort Order

Delete ProductDiscount

Endpoint: /{projectKey}/product-discounts/{id}
Method: DELETE
OAuth2 Scopes: manage_products:{projectKey} Query Parameters:

comments powered by Disqus