Round the discount. Closes #1297.

With cart percent discounts, before tax, we do it per item to account
for varying tax rates.

We need to round these values so the totals match. This may result in a
1p more or less overall, but per item it is correct.
This commit is contained in:
Mike Jolley 2012-07-27 15:11:09 +01:00
parent 07e2d50363
commit d68ef09e06
1 changed files with 3 additions and 2 deletions

View File

@ -932,9 +932,10 @@ class WC_Cart {
case "percent" :
$percent_discount = ( $values['data']->get_price( ) / 100 ) * $coupon->amount;
$percent_discount = round( ( $values['data']->get_price() / 100 ) * $coupon->amount, 2 );
if ( $add_totals ) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );
if ( $add_totals )
$this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );
$price = $price - $percent_discount;