how the order promotion is applied?

Vote:
 

Hi Team,

I have created order promotion(spend 500 get 5% off), item promotion(buy 20 item get 28% off) and both promotions are applied to one order.

case1: order promotion as a high priority.

I got the promotion price using below method 

        private Money GetDiscountedPrice(ILineItem lineItem, Currency currency)
        {
            return lineItem.GetDiscountedPrice(currency);
        }

But line-item promotion price has some variations.

case2: Item promotion as a high priority.

example: The order total value is the same for 2cases but item promotion value unexpected value in case1.

           unitPrice           qty   promotionPrice      OrderDiscount      SubTotal

case1:    $24.14            21       $372.09              $25.35               $346.74

case2:     $24.14            21        $365.00             $18.25              $346.74

my doubts:

Case 2: i am very clear in that. first, 28% applied then 5% applied.

case1: Expected is first 5% applied next 28% applied but I am doubted on the case2 promotion price calculation. Please anyone help me out,

how the promotion is calculated in the case1?

Advance Thanks,

#201027
Feb 01, 2019 19:30
Vote:
 

First one is:

(24.14 - (24.14 * 21 * 0.05 / 21)) * 0.72 * 21 = 346.74696

Or step by step:

24.14 * 21 = 506.94 | PlacedPrice * Qty = Order Total

506.94 * 0.05 = 25.347 | Order Total * OrderDiscount = Order Discount Total

25.237 / 21 = 1.207 | Order Discount Total / Qty = LineItem Order Discount (LIOD)

(24.14 - 1.207) * 0.72 = 16.51176 | (PlacedPrice - LIOD) * Item Discount = Extended Price

16.51176 * 21 = 346.74696 | Extended Price * Qty = SubTotal

Second one is:

24.14 * 0.72 * 21 * 0.95 = 346.74696

Though there seems to be a rounding error in terms of presentation since 365.00 - 18.25 = 346.75

#201044
Edited, Feb 03, 2019 23:09
Vote:
 

Thanks Jafet Valdez,

#201109
Feb 06, 2019 8:48
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.