WC_Cart_Totals::adjust_non_base_location_price( object $item )
Only ran if woocommerce_adjust_non_base_location_prices is true.
Description Description
If the customer is outside of the base location, this removes the base taxes. This is off by default unless the filter is used.
Uses edit context so unfiltered tax class is returned.
Parameters Parameters
- $item
-
(Required) Item to adjust the prices of.
Return Return
(object)
Source Source
File: includes/class-wc-cart-totals.php
protected function adjust_non_base_location_price( $item ) { if ( $item->price_includes_tax && $item->taxable ) { $base_tax_rates = WC_Tax::get_base_tax_rates( $item->product->get_tax_class( 'unfiltered' ) ); if ( $item->tax_rates !== $base_tax_rates ) { // Work out a new base price without the shop's base tax. $taxes = WC_Tax::calc_tax( $item->price, $base_tax_rates, true ); $new_taxes = WC_Tax::calc_tax( $item->price - array_sum( $taxes ), $item->tax_rates, false ); // Now we have a new item price. $item->price = $item->price - array_sum( $taxes ) + array_sum( $new_taxes ); } } return $item; }
Changelog Changelog
Version | Description |
---|---|
3.2.0 | Introduced. |