Merge branch 'fix/21871' into refactor/tax-rounding-methods
This commit is contained in:
commit
940ba59ab5
|
@ -1057,14 +1057,7 @@ function wc_get_price_excluding_tax( $product, $args = array() ) {
|
|||
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
|
||||
$base_tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class( 'unfiltered' ) );
|
||||
$remove_taxes = apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ? WC_Tax::calc_tax( $line_price, $base_tax_rates, true ) : WC_Tax::calc_tax( $line_price, $tax_rates, true );
|
||||
|
||||
if ( 'yes' === get_option( 'woocommerce_tax_round_at_subtotal' ) ) {
|
||||
$remove_taxes_total = array_sum( $remove_taxes );
|
||||
} else {
|
||||
$remove_taxes_total = array_sum( array_map( 'wc_round_tax_total', $remove_taxes ) );
|
||||
}
|
||||
|
||||
$return_price = round( $line_price - $remove_taxes_total, wc_get_price_decimals() );
|
||||
$return_price = $line_price - array_sum( $remove_taxes ); // Unrounded since we're dealing with tax inclusive prices. Matches logic in cart-totals class. @see adjust_non_base_location_price.
|
||||
} else {
|
||||
$return_price = $line_price;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue