API: Product Promotional Price

You can use the Salesforce B2C Commerce APIs to show the promotional price of a product on the product detail page or on a product list. The API provides the calculated price of an item via the getPromotionalPrice method (of the dw.campaign.Promotion class) if there is an applicable item level promotion ($ off, % off, or fixed price promotions without qualifying products only).

Note: The customer will only see promotions for which they are eligible.

Example

To calculate the promotional price, the getPromotionalPrice method uses the current sales price of the product for quantity 1.0, and applies the discount associated with the promotion to this price. If the product price is $14.99, and:

The promotion discount is... The method will return...
10% $13.49
$2 $12.99
$10.00 fixed price $10.00

To calculate the promotional price using the second version of the method (getPromotionalPrice(product : Product, optionModel : ProductOptionModel) using the ProductOptionModel parameter, consider a product base price of $15.00 and a selected options surcharge of $5.00.

The promotion discount is... The method will return...
10% $18.00
$2 $18.00
$10.00 fixed price $15.00

For percentage discounts, the discount is applied to the option surcharge, and for the other discount types, it only applies to the base product price.

dw.campaign.Promotion

Promotional Price

This class provides the following methods to calculate the promotional price of a product without actually adding the product to the basket and applying the promotion using the PromotionMgr API:

These methods are useful on product pages when you want to show the actual product price to the customer. These methods are restricted to simple product promotions without qualifying products and of discount type percentage, amount or fixed price. The methods don't consider the case of multiple promotions applying to a single product. As a result, there might be cases where the returned price doesn't reflect the actual charge to a consumer; but the methods should return accurate values in most scenarios.

Promotion Class

When using the getPromotionClass() method, you should consider the following:

Related Links

APIs for Promotions.

The B2C Commerce API documentation

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. By continuing to use this site you are giving us your consent to do this.