woocommerce_adjust_non_base_location_prices
woocommerce_adjust_non_base_location_prices
Appears in: woocommerce.3.4.2, woocommerce.3.4.4, woocommerce.3.4.5, woocommerce.3.4.6, woocommerce.3.4.7, woocommerce.3.5.0, woocommerce.3.5.1, woocommerce.3.5.2, woocommerce.3.5.3, woocommerce.3.5.4, woocommerce.3.5.5, woocommerce.3.5.6, woocommerce.3.5.7, woocommerce.3.5.8, woocommerce.3.6.1, woocommerce.3.6.2, woocommerce.3.6.3, woocommerce.3.6.4, woocommerce.3.6.5, woocommerce.3.7.0, woocommerce.3.7.1, woocommerce.3.8.0, woocommerce.3.8.1, woocommerce.3.9.0, woocommerce.3.9.1, woocommerce.3.9.2, woocommerce.3.9.3, woocommerce.4.0.0, woocommerce.4.0.1, woocommerce.4.1.0, woocommerce.4.1.1, woocommerce.4.2.0, woocommerce.4.2.1, woocommerce.4.3.0, woocommerce.4.3.1, woocommerce.4.3.2, woocommerce.4.3.3, woocommerce.4.4.0, woocommerce.4.4.1, woocommerce.4.5.1, woocommerce.4.5.2, woocommerce.4.6.0, woocommerce.4.6.1, woocommerce.4.6.2, woocommerce.4.7.0, woocommerce.4.7.1, woocommerce.4.8.0, woocommerce.4.9.0, woocommerce.4.9.1, woocommerce.4.9.2, woocommerce.5.0.0, woocommerce.5.1.0, woocommerce.5.2.0, woocommerce.5.2.1, woocommerce.5.2.2, woocommerce.5.3.0, woocommerce.5.4.0, woocommerce.5.4.1, woocommerce.5.5.0, woocommerce.5.5.1, woocommerce.5.5.2, woocommerce.5.6.0, woocommerce.5.6.1, woocommerce.5.7.0, woocommerce.5.7.1, woocommerce.5.8.0, woocommerce.6.3.1, woocommerce.6.4.1, woocommerce.6.5.1, woocommerce.6.6.1, woocommerce.6.7.0, woocommerce.6.8.0, woocommerce.6.8.1, woocommerce.6.8.2, woocommerce.6.9.0, woocommerce.6.9.4, woocommerce.7.0.0, woocommerce.7.1.0, woocommerce.7.1.1, woocommerce.7.2.2, woocommerce.7.3.0, woocommerce.7.4.0, woocommerce.7.4.1, woocommerce.7.5.1, woocommerce.7.6.0, woocommerce.7.6.1, woocommerce.7.7.0, woocommerce.7.7.1, woocommerce.7.8.1, woocommerce.7.9.0, woocommerce.8.0.2, woocommerce.8.0.3, woocommerce.8.1.1, woocommerce.8.2.1, woocommerce.8.2.2, woocommerce.8.3.1, woocommerce.8.4.0, woocommerce.8.5.1, woocommerce.8.5.2, woocommerce.8.6.0, woocommerce.8.6.1, woocommerce.8.7.0, woocommerce.8.8.3, woocommerce.8.9.2, woocommerce.8.9.3, woocommerce.9.0.2, woocommerce.9.1.2, woocommerce.9.1.4, woocommerce.9.2.2, woocommerce.9.2.3, woocommerce.9.3.1, woocommerce.9.3.3, woocommerce.9.4.2, woocommerce.9.4.3, woocommerce.9.5.1, woocommerce.9.5.2, woocommerce.9.7.0, woocommerce.9.7.1, woocommerce.9.8.1
Hook Type: filter
Displaying hooks found in version: woocommerce.9.8.1apply_filters('woocommerce_adjust_non_base_location_prices') is found 8 times:
- /includes/class-wc-cart-totals.php line 428424425426427428429430431432433434
* @
return
object
*/
protected
function
remove_item_base_taxes(
$item
) {
if
(
$item
->price_includes_tax &&
$item
->taxable ) {
if
( apply_filters(
'woocommerce_adjust_non_base_location_prices'
, true ) ) {
$base_tax_rates
= WC_Tax::get_base_tax_rates(
$item
->product->get_tax_class(
'unfiltered'
) );
}
else
{
/**
* If we want all customers to pay the same price on this store, we should not remove base taxes from a VAT exempt user's price,
* but just the relevant tax rate. See issue #20911.
*/
- /includes/class-wc-cart-totals.php line 723719720721722723724725726727728729
*/
protected
function
calculate_item_subtotals() {
$merged_subtotal_taxes
=
array
();
// Taxes indexed by tax rate ID for storage later.
$adjust_non_base_location_prices
= apply_filters(
'woocommerce_adjust_non_base_location_prices'
, true );
$is_customer_vat_exempt
=
$this
->cart->get_customer()->get_is_vat_exempt();
foreach
(
$this
->items
as
$item_key
=>
$item
) {
if
(
$item
->price_includes_tax ) {
if
(
$is_customer_vat_exempt
) {
$item
=
$this
->remove_item_base_taxes(
$item
);
- /includes/wc-product-functions.php line 122112171218121912201221122212231224122512261227
* If the customer is exempt from VAT, remove the taxes here.
* Either remove the base
or
the user taxes depending on woocommerce_adjust_non_base_location_prices setting.
*/
if
( !
empty
( WC()->customer ) && WC()->customer->get_is_vat_exempt() ) {
// @codingStandardsIgnoreLine.
$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
) );
}
- /includes/wc-product-functions.php line 123612321233123412351236123712381239124012411242
* The woocommerce_adjust_non_base_location_prices filter can stop base taxes being taken off when dealing with out of base locations.
* e.g. If a product costs 10 including tax, all users will pay 10 regardless of location
and
taxes.
* This feature is experimental @since 2.4.7
and
may change in the future. Use at your risk.
*/
}
elseif
(
$tax_rates
!==
$base_tax_rates
&& apply_filters(
'woocommerce_adjust_non_base_location_prices'
, true ) ) {
$base_taxes
= WC_Tax::calc_tax(
$line_price
,
$base_tax_rates
, true );
$modded_taxes
= WC_Tax::calc_tax(
$line_price
-
array_sum
(
$base_taxes
),
$tax_rates
, false );
if
(
'yes'
=== get_option(
'woocommerce_tax_round_at_subtotal'
) ) {
$base_taxes_total
=
array_sum
(
$base_taxes
);
$modded_taxes_total
=
array_sum
(
$modded_taxes
);
- /includes/wc-product-functions.php line 12881285128612871288128912901291129212931294
if
(
$product
->is_taxable() && wc_prices_include_tax() ) {
$order
= ArrayUtil::get_value_or_default(
$args
,
'order'
);
$customer_id
=
$order
?
$order
->get_customer_id() : 0;
if
( apply_filters(
'woocommerce_adjust_non_base_location_prices'
, true ) ) {
$tax_rates
= WC_Tax::get_base_tax_rates(
$product
->get_tax_class(
'unfiltered'
) );
}
else
{
$customer
=
$customer_id
? wc_get_container()->get( LegacyProxy::
class
)->get_instance_of( WC_Customer::
class
,
$customer_id
) : null;
$tax_rates
= WC_Tax::get_rates(
$product
->get_tax_class(),
$customer
);
}
$remove_taxes
= WC_Tax::calc_tax(
$line_price
,
$tax_rates
, true );
- /src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php line 934930931932933934935936937938939
*
* @param boolean
$adjust_non_base_location_prices
True by
default
.
* @
return
boolean
*/
$taxes
= apply_filters(
'woocommerce_adjust_non_base_location_prices'
, true ) ? WC_Tax::calc_tax(
$price_filter
,
$base_tax_rates
, true ) : WC_Tax::calc_tax(
$price_filter
,
$tax_rates
, true );
return
$price_filter
-
array_sum
(
$taxes
);
}
// If prices are shown excl. tax, add taxes to match the prices stored in the DB.
$taxes
= WC_Tax::calc_tax(
$price_filter
,
$tax_rates
, false );
- /src/Blocks/QueryFilters.php line 383379380381382383384385386387388
*
* @param boolean
$adjust_non_base_location_prices
True by
default
.
* @
return
boolean
*/
$taxes
= apply_filters(
'woocommerce_adjust_non_base_location_prices'
, true ) ? WC_Tax::calc_tax(
$price_filter
,
$base_tax_rates
, true ) : WC_Tax::calc_tax(
$price_filter
,
$tax_rates
, true );
return
$price_filter
-
array_sum
(
$taxes
);
}
// If prices are shown excl. tax, add taxes to match the prices stored in the DB.
$taxes
= WC_Tax::calc_tax(
$price_filter
,
$tax_rates
, false );
- /src/StoreApi/Utilities/ProductQuery.php line 530526527528529530531532533534535
*
* @param boolean
$adjust_non_base_location_prices
True by
default
.
* @
return
boolean
*/
$taxes
= apply_filters(
'woocommerce_adjust_non_base_location_prices'
, true ) ? WC_Tax::calc_tax(
$price_filter
,
$base_tax_rates
, true ) : WC_Tax::calc_tax(
$price_filter
,
$tax_rates
, true );
return
$price_filter
-
array_sum
(
$taxes
);
}
// If prices are shown excl. tax, add taxes to match the prices stored in the DB.
$taxes
= WC_Tax::calc_tax(
$price_filter
,
$tax_rates
, false );