Fixe fatal error while trying to sum an empty array

This commit is contained in:
Claudio Sanches 2017-07-28 17:38:43 -03:00
parent eb64d59343
commit de52221004
1 changed files with 1 additions and 1 deletions

View File

@ -497,7 +497,7 @@ final class WC_Cart_Totals {
}
$this->discount_totals = $discounts->get_discounts_by_item( true );
$this->totals['discounts_total'] = array_sum( $this->discount_totals );
$this->totals['discounts_total'] = ! empty( $this->discount_totals ) ? array_sum( $this->discount_totals ) : 0;
$this->object->coupon_discount_amounts = $discounts->get_discounts_by_coupon();
// See how much tax was 'discounted' per item and per coupon.