Fix possible notice
This commit is contained in:
parent
e6b94e486b
commit
7ebd7399cb
|
@ -150,29 +150,28 @@ class WC_Tax {
|
||||||
private static function calc_exclusive_tax( $price, $rates ) {
|
private static function calc_exclusive_tax( $price, $rates ) {
|
||||||
$taxes = array();
|
$taxes = array();
|
||||||
|
|
||||||
// Multiple taxes
|
if ( $rates ) {
|
||||||
foreach ( $rates as $key => $rate ) {
|
// Multiple taxes
|
||||||
|
foreach ( $rates as $key => $rate ) {
|
||||||
|
|
||||||
if ( $rate['compound'] == 'yes' ) {
|
if ( $rate['compound'] == 'yes' )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
$tax_amount = $price * ( $rate['rate'] / 100 );
|
||||||
|
|
||||||
|
// ADVANCED: Allow third parties to modify this rate
|
||||||
|
$tax_amount = apply_filters( 'woocommerce_price_ex_tax_amount', $tax_amount, $key, $rate, $price );
|
||||||
|
|
||||||
|
// Add rate
|
||||||
|
if ( ! isset( $taxes[ $key ] ) )
|
||||||
|
$taxes[ $key ] = $tax_amount;
|
||||||
|
else
|
||||||
|
$taxes[ $key ] += $tax_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tax_amount = $price * ( $rate['rate'] / 100 );
|
$pre_compound_total = array_sum( $taxes );
|
||||||
|
|
||||||
// ADVANCED: Allow third parties to modify this rate
|
// Compound taxes
|
||||||
$tax_amount = apply_filters( 'woocommerce_price_ex_tax_amount', $tax_amount, $key, $rate, $price );
|
|
||||||
|
|
||||||
// Add rate
|
|
||||||
if ( ! isset( $taxes[ $key ] ) )
|
|
||||||
$taxes[ $key ] = $tax_amount;
|
|
||||||
else
|
|
||||||
$taxes[ $key ] += $tax_amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pre_compound_total = array_sum( $taxes );
|
|
||||||
|
|
||||||
// Compound taxes
|
|
||||||
if ( $rates ) {
|
|
||||||
foreach ( $rates as $key => $rate ) {
|
foreach ( $rates as $key => $rate ) {
|
||||||
|
|
||||||
if ( $rate['compound'] == 'no' )
|
if ( $rate['compound'] == 'no' )
|
||||||
|
|
Loading…
Reference in New Issue