woocommerce_adjust_non_base_location_prices, true
woocommerce_adjust_non_base_location_prices, true
Appears in: woocommerce.11.0.0
Hook Type: filter
Displaying hooks found in version: woocommerce.11.0.0apply_filters('woocommerce_adjust_non_base_location_prices, true') is found 9 times:
- /includes/admin/settings/class-wc-settings-tax.php line 407
* @since 2.4.7 * * @param bool $adjust_non_base_location_prices True by default. */ if ( ! apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ) { return; } // Check if base location has tax rates configured. $base_location = wc_get_base_location(); if ( empty( $base_location['country'] ) ) { - /includes/class-wc-cart-totals.php line 423
* @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 720
*/ 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 ); $customer = $this->cart->get_customer(); $is_customer_vat_exempt = $customer && $customer->get_is_vat_exempt(); foreach ( $this->items as $item_key => $item ) { if ( $item->price_includes_tax ) { if ( $is_customer_vat_exempt ) { - /includes/wc-product-functions.php line 1549
* 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 1564
* 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 1618
$order = ArrayUtil::get_value_or_default( $args, 'order' ); $customer_id = $order ? $order->get_customer_id() : 0; $tax_rates = false; if ( apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ) { $tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class( 'unfiltered' ) ); } elseif ( $customer_id ) { $customer = wc_get_container()->get( LegacyProxy::class )->get_instance_of( WC_Customer::class, $customer_id ); $tax_rates = WC_Tax::get_rates( $product->get_tax_class(), $customer ); } elseif ( is_object( $order ) && method_exists( $order, 'get_taxable_location' ) ) { $tax_location = $order->get_taxable_location(); - /src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php line 1003
* * @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/Internal/ProductFilters/QueryClauses.php line 541
* * @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 610
* * @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 );