diff --git a/includes/class-wc-cart-totals.php b/includes/class-wc-cart-totals.php index 538977363f0..34f64c1f396 100644 --- a/includes/class-wc-cart-totals.php +++ b/includes/class-wc-cart-totals.php @@ -579,10 +579,28 @@ final class WC_Cart_Totals { $taxes[ $rate_id ] += $this->round_line_tax( $rate ); } } + $taxes = $this->round_merged_taxes( $taxes ); return $in_cents ? $taxes : wc_remove_number_precision_deep( $taxes ); } + /** + * Round merged taxes. + * + * @since 3.4.5 + * @param array $taxes Taxes to round. + * @return array + */ + protected function round_merged_taxes( $taxes ) { + if ( $this->round_at_subtotal() ) { + foreach ( $taxes as $rate_id => $tax ) { + $taxes[ $rate_id ] = wc_round_tax_total( $tax, 0 ); + } + } + + return $taxes; + } + /** * Combine item taxes into a single array, preserving keys. *