Cart summary rounds the package and addon discounts separately

Sheernox

New Member
Env: ClientExec 7.2.2 (ionCube), PHP 8.5.10, MariaDB 11.8.9.

Where: templates/order_forms/partials/cartSummary.phtml: writeTerm() discounts the package fee (line 262) and the summed addon fees (line 275) with separate calcDiscount() calls, and calcDiscount() rounds each result to the currency precision (lines 100-113).

Bug: With a percentage coupon that applies to Package and Package Add-ons, step 2's "Total Due Today" can be a cent higher than the order total on step 3 and the invoice, which take the percent off the package and addons together.

Repro: A product at 47.88/year with a quantity addon at 59.88/year, a 30% coupon applied to Package and Package Add-ons. On step 2, set the addon quantity to 3: the summary shows 159.27 (47.88 - 14.36 + 179.64 - 53.89). Continue to step 3: Discounts 68.26, Grand Total 159.26.

Fix: Sum the discountable amounts first and call calcDiscount() once, as checkout does.
 
Back
Top