Prorating Promotions

Promotion discounts aren't prorated for each line item during the actual shopping process. However, B2C Commerce provides an API that calculates the prorated values in-memory and returns them to the caller upon request. Prorated price information is typically used to integrate with back-end order management and accounting systems that require all discounts to be itemized.

Product Promotions

Product promotions can be prorated in two ways.

Amount and percent off product promotions can be prorated. Just select the option when creating the promotion. Otherwise, a product promotion is only prorated when a discount is unevenly applied to a combined total of line items. For example, buy SKU1 and SKU2 for a total of 20 dollars. A discount that affects line items individually isn't prorated. For example, get 10% off all shirts in the order.

Order Promotions

The API calculates a prorated value for each qualifying unit according to the adjusted price of the unit after product and previous order discounts. It calculates one product-level price adjustment for each line item not excluded by the order promotion.

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 when order promotions are prorated, because of a rounding error.

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. The order of proration particularly impacts orders with split shipping. For example, an order reaches the amount necessary to trigger a shipping promotion, but the individual shipments don't qualify after the proration is 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 price adjustments only, 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.