# Promotion Proration Logic

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. Proration helps when processing completed orders, such as a product return.

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.

As with order-based promotions, total-fixed promotions are prorated across multiple products to spread the weight of the discount across the products using a step algorithm. Discounts are calculated based on the total price and total discount price. To avoid losing precision because of rounding, the discount amount and the ultimate cost of the products are recalculated after applying the promotion to each product.

The discount for the first product is calculated using the equation P*(-D)/T where P=Product price, D=Discount remaining, and T=Total cost. Then the discount is then calculated for the next product, using that product's price and the discount remaining after the first calculation. This process repeats for all products until the final product, when the remaining discount is subtracted from the final product's cost.

Product Quantity Base Price Discount Prorated Discount Calculation Prorated Price Adjustment
SKU1 1 \$13.00
SKU2 1 \$13.00
SKU3 1 \$12.00
All products for \$22.00 (prorated)       NA (remaining discount is subtracted from the cost) –\$.5.05
Subtotal   \$38.00
Total     \$22.00

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

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 \$7.03 back instead of \$0.00.

Product Quantity Base Price Discount Prorated Price Adjustment (Product Promotion) Prorated Price Adjustment (Product and Order Promotions)
SKU1 1 \$27.00