Prorating Promotions

For order promotions, Salesforce B2C Commerce applies the discount to the entire order and doesn't prorate the discount for each item in the order.. However, B2C Commerce provides an API, which calculates the prorated values in-memory and returns them to the caller. The API does not store the prorated values on the order, but simply recalculates them on the fly. Prorated price information is typically used to integrate with back-end order-management and accounting systems that require all discounts to be itemized.

Order Promotions

The API calculates the prorated values for order discounts across all qualifying units in the order. The API doesn't calculate the prices of non-qualifying products. It calculates a prorated value for each qualifying unit according to the adjusted price of the unit after product discounts, taking into account previously applied order discounts. It calculates one product-level price adjustment for each line item that contains at least one unit included in the proration. It doesn't calculate a total price adjustment for the whole order.

Order promotions are still considered order promotions for the purpose of exclusivity rules. If a product line item receives a class exclusive product promotion, it's still eligible to receive a prorated order discount. Order promotions are prorated after product promotions.

Taxes

When calculating the tax for a product line item, the API applies the tax rate of the product to the adjusted price after the product and prorated order promotions are applied. The order total is the same regardless of whether order promotions are prorated. However, because the API applies tax on each line item, taxes can be slightly higher-due to a rounding error-when order promotions are prorated.

You can also use the Line Item Tax Basis feature to prorate taxes across an order and eliminate potential rounding errors.

Shipping Promotions

The merchandise total used for determining qualification for shipping promotions is the total of all product line items in the shipment after the product and prorated order promotions are applied.

Proration APIs

B2C Commerce provides an algorithm for prorating Buy-X-Get-Y product discounts. If your application requires itemized information described above, these APIs let you retrieve prorated prices:

Class Method
dw.order.PriceAdjustment getProratedPrices() : Map
dw.order.ProductLineItem

getProratedPriceAdjustmentPrices() : Map

getProratedPrice() : Money

dw.order.Shipment

getProratedMerchandizeTotalPrice() : Money

The following methods consider only price adjustments, while the methods listed above consider both order and Buy-X-Get-Y price adjustments.

Class Method
dw.order.ProductLineItem

getAdjustedPrice(boolean applyOrderLevelAdjustments) : Money

dw.order.Shipment getAdjustedMerchandizeTotalPrice(boolean applyOrderLevelAdjustments) : Money

See the API documentation for additional details.

Examples

The following examples demonstrate how proration works on various product and order discounts. Without proration, the promotion is calculated once at the end. With proration, the promotion is calculated proportionately for each line item.

Prorating an Order Discount

For this example, the promotion is 15% off orders over $100.

Product Quantity Base Price Discount Prorated Price Adjustment
SKU1 1 $60.00    
15% off orders over $100 (proration)       -$9.00
SKU2 1 $50.00    
15% off orders over $100 (proration)       -$7.50
Subtotal   $110.00    
15% off orders over $100 (net)     -$16.50  
Total     $93.50  

Prorating an Order Discount with an Additional Product Promotion.

For this example, promotion-1 is $10 off SKU1 and promotion-2 is '15% off orders over $100'.

Product Quantity Base Price Discount Prorated Price Adjustment
SKU1 1 $60.00    
$10 off SKU1     -$10.00 -$10.00
15% off orders over $100 (proration)       -$7.50
SKU2 1 $50.00    
15% off orders over $100 (proration)       -$7.50
Subtotal   $100.00    
15% off orders over $100 (net)     -$15.00  
Total     $85.00  

Prorating an Order Discount with an Excluded Product

For this example, the promotion is 15% off orders over $100, with SKU3 excluded from the promotion.

Product Quantity Base Price Discount Prorated Price Adjustment
SKU1 1 $60.00    
15% off orders over $100, excluding SKU3 (proration)       -$9.00
SKU2 1 $50.00    
15% off orders over $100, excluding SKU3 (proration)       -$7.50
SKU3 1 $40.00    
15% off orders over $100, excluding SKU3 (proration)        
Subtotal   $150.00    
15% off orders over $100, excluding SKU3 (net)     -$16.50  
Total     $133.50  

Prorating a Product Discount with a Fixed Amount

For this example, the promotion is Buy SKU1, SKU2, and SKU3 for $22.00'. To see more information on how the exact discount is calculated, see Promotion Proration Logic.

Product Quantity Base Price Discount Prorated Price Adjustment
SKU1 1 $13.00    
All products for $22.00 (prorated)       -$5.47
SKU2 1 $13.00    
All products for $22.00 (prorated)       -$5.48
SKU3 1 $12.00    
All products for $22.00 (prorated)       -$.5.05
Subtotal   $38.00    
All products for $22.00 (net)     -$16.00  
Total     $22.00  

Prorating a Product Discount with Buy-X-Get-Y and an additional Order Discount.

For this example, the product promotion is Buy one item and get a cheaper item for free and the order promotion is 10% off your order.

Proration helps when processing completed orders, such as when processing a product return.

In the Buy-X-Get-Y promotion, the customer sees SKU1 as discounted and SKU2 as free. However, with proration, the cost of the free item, $10.99, is divided among each product. SKU1's cost decreases by $7.81 to $19.19 and SKU2's cost decreases by $3.18 to $7.81. The products are then discounted further by the order promotion; SKU1's cost decreases to $17.27 and SKU2's cost decreases to $7.03. When processing a return for SKU2, the customer receives back $7.03 instead of $0.00.

Related Links

Campaigns and Promotions

Promotions and Taxation