Fix possible notice

This commit is contained in:
Nicola Mustone 2014-12-09 10:14:25 +01:00
parent e6b94e486b
commit 7ebd7399cb
1 changed files with 18 additions and 19 deletions

View File

@ -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' )