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:
parent
07e2d50363
commit
d68ef09e06
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue