Quantity Discounts with Combinations ignore combination price increase and use base price

I’ve raised this as a new issue as it’s not related to the AEUC module but is from the default install of 1.0.3 with no changes made.
I’ve tested out the quantity discount on the candle product option ‘puffin 16oz’ with 5% discount on 2 or more. Base price is $20.50, I save up to $2.05 but when I change the quantity to 2 the new price changes from $20.50 to $15.68.
This price of $20.50 is an increase from the base of $4.00 (original $16.50) so it looks like the quantity discount is ignoring the price increase for the combination and working from the $16.50, not the $20.50. Also I’m not sure how $16.50  $1.025 (rounds to $1.03) becomes $15.68.
When added to the cart the unit price is correctly shown as $19.48 down from $20.50 ( 5%) so it looks like some issue on the product page only.
I tested with the 12 oz honey, the base product and it had the right discount. I also tried with the 12 oz puffin (no price uplift) and it was also correct indicating it is ignoring the impact on price when displaying the new discounted price on the product page.

I’ve just committed a fix for that issue.
can you check it and see if it solves the issue.
https://github.com/thirtybees/communitythemedefault/pull/24/commits/674c6d61f66411e0e263f4db713000fcfdec07eb

@yaniv14 Thanks that sorts out the discount when the combination has an uplift and it’s in the cart but there’s some weird logic going on for the cart with quantities and discounts when you’ve got more than one combination in the cart.
Say I’ve got Honey 12oz with discount of 10% for 3+ so $16.50 drops down to $14.85. In the cart when you add the 3 it shows the discount OK and changing the quantity below 3 units removes the discount, which is correct.
Now lets add Puffin 12oz, it’s using base price of $16.50 with discount of 15% on 3+ units. If I had 1 unit in the cart and 1 of the other Honey 12oz then it’s showing both as price $16.50 but as soon as I increase either of them to 2 units then both of them get their appropriate discount because I’ve got 3 units in the cart.
Furthermore, if I took the honey 12 oz from the cart then readded it as 1 unit, when I go to the cart it’s showing a discount of $1.65. If I then increase this to 2 units it switches to showing the discount as 10%. Dropping back to 1 unit still shows as 10% discount and not the $1.65, this only happens on the initial add to cart. I also tried a combination with an uplift in this scenario and it still had the right discount applied (your fix) but it behaved exactly the same.
To sum it all up : The quantity discounts are being applied based on any 3 of that product in the cart when it should be 3 of that specific combination in the cart.
There’s also some sort of rounding issue but it’s visual only, it doesn’t affect the final price. By this I mean $16.50  15% shows as $14.03 (when it’s really $14.025) but for 6 products the price should be $84.18 (6 x $14.03) whereas it’s $84.15. However, if you do ($16.50 x 6)  15% then you get $84.15.

@DavidP , have you tried to play with option “Quantity discounts based on” ? Just interesting will that option have any effect in your case?
Same about rounding options  there are at least 18 possible variations of rounding. Again it is interesting  are you really didn’t found what you need among that?

@daokakao thankyou, I didn’t know about the ‘Quantity discounts based on’ feature. I’ve reran my tests on my TB site and it does indeed work as I had hoped with the quantity discount being based on the quantity of that combination in the cart.
I’ve experimented with the rounding options. The nearest value shows my 15% discount in the cart as 14.99% for taking $16.50 to $14.03. I also tried rounding on the final total but it’s still showing as $42.08 not $42.09 as would be expected for 3 x $14.03. For the various round modes I get the following (based on 3 units):
Round up away from zero (recommended) : unit $14.03, total $42.08 (same for round on each item, each line)
Round down towards zero: unit $14.02, total $42.07 (same for round on each item, each line)
Round towards nearest even: $14.02, total $42.08 (same for round on each item, each line)
Round towards nearest odd: $14.03, total $42.07 (same for round on each item, each line)
Round up to the nearest value: $14.03, total $42.08  % shows as 14.99% not 15% (same for round on each item, each line)
Round down to nearest value: $14.02, total $42.07 (same for round on each item, each line)The last one of rounding on total is the overall invoice total but it seemed to be correct based on the total of each line and not the products (came out as $86.63).
It seems that probably the best combo is round up away from zero when half way there and round on each item. The overall total was correct at $86.64 ($14.03 x 3 + $14.85 x 3).

You right, this rounding method (up away from zero) sometimes also called as ‘banking rounding’  it helps to relief the rounding errors accumulation.

@yaniv14 Just found your changes on GitHub. Will make sure they land in the software, but can you please make new pull requests with every change? Adding a commit to an old one goes unnoticed and what if we do not want to merge the previous commit?

This post is deleted!