parent
93811e0a56
commit
57d336433a
|
@ -1672,18 +1672,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
public function calculate_totals( $and_taxes = true ) {
|
||||
do_action( 'woocommerce_order_before_calculate_totals', $and_taxes, $this );
|
||||
|
||||
$cart_subtotal = 0;
|
||||
$cart_total = 0;
|
||||
$fees_total = 0;
|
||||
$shipping_total = 0;
|
||||
$cart_subtotal_tax = 0;
|
||||
$cart_total_tax = 0;
|
||||
|
||||
// Sum line item costs without rounding.
|
||||
foreach ( $this->get_items() as $item ) {
|
||||
$cart_subtotal += $item->get_subtotal();
|
||||
$cart_total += $item->get_total();
|
||||
}
|
||||
$cart_subtotal = $this->get_cart_subtotal_for_order();
|
||||
$cart_total = $this->get_cart_total_for_order();
|
||||
|
||||
// Sum shipping costs.
|
||||
foreach ( $this->get_shipping_methods() as $shipping ) {
|
||||
|
|
|
@ -371,6 +371,7 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
|
|||
public function test_inclusive_tax_rounding_on_totals() {
|
||||
update_option( 'woocommerce_prices_include_tax', 'yes' );
|
||||
update_option( 'woocommerce_calc_taxes', 'yes' );
|
||||
update_option( 'woocommerce_tax_round_at_subtotal', 'yes' );
|
||||
|
||||
WC_Tax::_insert_tax_rate(
|
||||
array(
|
||||
|
@ -440,12 +441,9 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
|
|||
$order->apply_coupon( $coupon->get_code() );
|
||||
|
||||
$applied_coupons = $order->get_items( 'coupon' );
|
||||
$applied_coupon = current( $applied_coupons );
|
||||
|
||||
$this->assertEquals( '16.95', $order->get_total() );
|
||||
$this->assertEquals( '1.73', $order->get_total_tax() );
|
||||
$this->assertEquals( '1.69', $order->get_discount_total() );
|
||||
|
||||
$this->assertEquals( '1.69', $applied_coupon->get_discount() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue