Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked.
This commit is contained in:
parent
5c3f4c9c10
commit
20ac4a8b69
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue