Fix rounding of line items for orders
This commit is contained in:
parent
6c1234668a
commit
d25bd2dd33
|
@ -1358,7 +1358,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {
|
||||
$taxes = $item->get_taxes();
|
||||
foreach ( $taxes['total'] as $tax_rate_id => $tax ) {
|
||||
$cart_taxes[ $tax_rate_id ] = isset( $cart_taxes[ $tax_rate_id ] ) ? $cart_taxes[ $tax_rate_id ] + (float) $tax : (float) $tax;
|
||||
$tax_amount = (float) $tax;
|
||||
|
||||
if ( 'yes' !== get_option( 'woocommerce_tax_round_at_subtotal' ) ) {
|
||||
$tax_amount = wc_round_tax_total( $tax_amount );
|
||||
}
|
||||
|
||||
$cart_taxes[ $tax_rate_id ] = isset( $cart_taxes[ $tax_rate_id ] ) ? $cart_taxes[ $tax_rate_id ] + $tax_amount : $tax_amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue