Rounding and price should match the cart.

This commit is contained in:
Mike Jolley 2017-12-04 20:38:29 +00:00
parent 17095a4011
commit 8e851d834f
1 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ class WC_Discounts {
$item->object = $cart_item; $item->object = $cart_item;
$item->product = $cart_item['data']; $item->product = $cart_item['data'];
$item->quantity = $cart_item['quantity']; $item->quantity = $cart_item['quantity'];
$item->price = wc_add_number_precision_deep( $item->product->get_price() ) * $item->quantity; $item->price = wc_add_number_precision_deep( $item->product->get_price() * $item->quantity );
$this->items[ $key ] = $item; $this->items[ $key ] = $item;
} }
@ -370,7 +370,7 @@ class WC_Discounts {
} }
} }
$discount = min( $discounted_price, $discount ); $discount = wc_cart_round_discount( min( $discounted_price, $discount ), 0 );
$cart_total = $cart_total + $price_to_discount; $cart_total = $cart_total + $price_to_discount;
$total_discount = $total_discount + $discount; $total_discount = $total_discount + $discount;
$applied_count = $applied_count + $apply_quantity; $applied_count = $applied_count + $apply_quantity;