Avoid 'division by zero' warnings
SHA 85befad283
does not avoid these
warnings if `$inc_tax` is `false`.
This commit is contained in:
parent
f699f5102c
commit
d4b08daa64
|
@ -1374,7 +1374,7 @@ abstract class WC_Abstract_Order {
|
||||||
if ( $inc_tax ) {
|
if ( $inc_tax ) {
|
||||||
$price = ( $item['line_subtotal'] + $item['line_subtotal_tax'] ) / max( 1, $item['qty'] );
|
$price = ( $item['line_subtotal'] + $item['line_subtotal_tax'] ) / max( 1, $item['qty'] );
|
||||||
} else {
|
} else {
|
||||||
$price = ( $item['line_subtotal'] / $item['qty'] );
|
$price = ( $item['line_subtotal'] / max( 1, $item['qty'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$price = $round ? number_format( (float) $price, 2, '.', '' ) : $price;
|
$price = $round ? number_format( (float) $price, 2, '.', '' ) : $price;
|
||||||
|
@ -1418,7 +1418,7 @@ abstract class WC_Abstract_Order {
|
||||||
if ( $inc_tax ) {
|
if ( $inc_tax ) {
|
||||||
$price = ( $item['line_total'] + $item['line_tax'] ) / max( 1, $qty );
|
$price = ( $item['line_total'] + $item['line_tax'] ) / max( 1, $qty );
|
||||||
} else {
|
} else {
|
||||||
$price = $item['line_total'] / $qty;
|
$price = $item['line_total'] / max( 1, $qty );
|
||||||
}
|
}
|
||||||
|
|
||||||
$price = $round ? round( $price, 2 ) : $price;
|
$price = $round ? round( $price, 2 ) : $price;
|
||||||
|
|
Loading…
Reference in New Issue