Merge branch 'universal-pricing-test'

This commit is contained in:
Mike Jolley 2015-09-15 15:57:04 +01:00
commit 4959937689
2 changed files with 4 additions and 4 deletions

View File

@ -827,7 +827,7 @@ class WC_Product {
$base_tax_amount = array_sum( $base_taxes );
$price = round( $price * $qty - $base_tax_amount, wc_get_price_decimals() );
} elseif ( $tax_rates !== $base_tax_rates ) {
} elseif ( $tax_rates !== $base_tax_rates && apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ) {
$base_taxes = WC_Tax::calc_tax( $price * $qty, $base_tax_rates, true );
$modded_taxes = WC_Tax::calc_tax( ( $price * $qty ) - array_sum( $base_taxes ), $tax_rates, false );
@ -861,7 +861,7 @@ class WC_Product {
$price = $this->get_price();
}
if ( $this->is_taxable() && get_option( 'woocommerce_prices_include_tax' ) === 'yes' ) {
if ( $this->is_taxable() && 'yes' === get_option( 'woocommerce_prices_include_tax' ) ) {
$tax_rates = WC_Tax::get_base_tax_rates( $this->tax_class );
$taxes = WC_Tax::calc_tax( $price * $qty, $tax_rates, true );
$price = WC_Tax::round( $price * $qty - array_sum( $taxes ) );

View File

@ -1143,7 +1143,7 @@ class WC_Cart {
/**
* ADJUST TAX - Calculations when base tax is not equal to the item tax
*/
if ( $item_tax_rates !== $base_tax_rates ) {
if ( $item_tax_rates !== $base_tax_rates && apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ) {
// Work out a new base price without the shop's base tax
$taxes = WC_Tax::calc_tax( $line_price, $base_tax_rates, true, true );
@ -1233,7 +1233,7 @@ class WC_Cart {
/**
* ADJUST TAX - Calculations when base tax is not equal to the item tax
*/
if ( $item_tax_rates !== $base_tax_rates ) {
if ( $item_tax_rates !== $base_tax_rates && apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ) {
// Work out a new base price without the shop's base tax
$taxes = WC_Tax::calc_tax( $line_price, $base_tax_rates, true, true );