Avoid 'division by zero' warnings

SHA 85befad283 does not avoid these
warnings if `$inc_tax` is `false`.
This commit is contained in:
Tamara Zuk 2015-03-06 17:46:31 -05:00
parent f699f5102c
commit d4b08daa64
1 changed files with 2 additions and 2 deletions

View File

@ -1374,7 +1374,7 @@ abstract class WC_Abstract_Order {
if ( $inc_tax ) {
$price = ( $item['line_subtotal'] + $item['line_subtotal_tax'] ) / max( 1, $item['qty'] );
} else {
$price = ( $item['line_subtotal'] / $item['qty'] );
$price = ( $item['line_subtotal'] / max( 1, $item['qty'] ) );
}
$price = $round ? number_format( (float) $price, 2, '.', '' ) : $price;
@ -1418,7 +1418,7 @@ abstract class WC_Abstract_Order {
if ( $inc_tax ) {
$price = ( $item['line_total'] + $item['line_tax'] ) / max( 1, $qty );
} else {
$price = $item['line_total'] / $qty;
$price = $item['line_total'] / max( 1, $qty );
}
$price = $round ? round( $price, 2 ) : $price;