Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked.
This commit is contained in:
parent
b80c6d86fc
commit
dafcbc56b0
|
@ -580,9 +580,28 @@ final class WC_Cart_Totals {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$taxes = $this->round_merged_taxes( $taxes );
|
||||||
|
|
||||||
return $in_cents ? $taxes : wc_remove_number_precision_deep( $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.
|
* Combine item taxes into a single array, preserving keys.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue