From b6f87e70d78fe828aec1828499e34c8b24ce1781 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 4 Dec 2017 22:42:39 +0000 Subject: [PATCH] round total to cents --- includes/class-wc-cart-totals.php | 2 +- tests/unit-tests/cart/cart.php | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/includes/class-wc-cart-totals.php b/includes/class-wc-cart-totals.php index 4d239ead9cd..ea4740784b9 100644 --- a/includes/class-wc-cart-totals.php +++ b/includes/class-wc-cart-totals.php @@ -806,7 +806,7 @@ final class WC_Cart_Totals { * @since 3.2.0 */ protected function calculate_totals() { - $this->set_total( 'total', round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ) ) ); + $this->set_total( 'total', round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ), 0 ) ); $this->cart->set_total_tax( array_sum( $this->get_merged_taxes( false ) ) ); // Allow plugins to hook and alter totals before final total is calculated. diff --git a/tests/unit-tests/cart/cart.php b/tests/unit-tests/cart/cart.php index c7fe4a88982..a09d7247346 100644 --- a/tests/unit-tests/cart/cart.php +++ b/tests/unit-tests/cart/cart.php @@ -6,21 +6,6 @@ */ class WC_Tests_Cart extends WC_Unit_Test_Case { - /** - * Clean up after test. - */ - public function tearDown() { - global $wpdb; - WC()->cart->empty_cart(); - WC()->cart->remove_coupons(); - WC()->session->set( 'chosen_shipping_methods', array() ); - WC_Helper_Shipping::delete_simple_flat_rate(); - update_option( 'woocommerce_prices_include_tax', 'no' ); - update_option( 'woocommerce_calc_taxes', 'no' ); - $wpdb->query( "DELETE FROM {$wpdb->prefix}woocommerce_tax_rates" ); - $wpdb->query( "DELETE FROM {$wpdb->prefix}woocommerce_tax_rate_locations" ); - } - /** * Test some discount logic which has caused issues in the past. * Tickets: