round total to cents

This commit is contained in:
Mike Jolley 2017-12-04 22:42:39 +00:00
parent 077ced6657
commit b6f87e70d7
2 changed files with 1 additions and 16 deletions

View File

@ -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.

View File

@ -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: