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:

  • getPromotionalPrice(product : Product) : Money
  • getPromotionalPrice(product : Product, optionModel : ProductOptionModel) : Money

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:

  • A promotion can be combined in the shopping cart with other active product promotions, resulting in a different price reduction. Promotional price isn't considered for product sorting. The API does not consider dependencies between promotions.
  • When implementing this feature, you should consider the currently selected product options. If a product option is selected by the customer, the value of the promotional discount message should be calculated on the total value of the item (which would include surcharges). For example, if the currently selected product options add a surcharge to the product, a "10% off promotion" should also take 10% off the surcharge.

Related Links

APIs for Promotions.

The B2C Commerce API documentation