Cart\Cart::totalExcludingTax PHP 메소드

totalExcludingTax() 공개 메소드

Get the cart total excluding tax.
public totalExcludingTax ( ) : float
리턴 float
    public function totalExcludingTax()
    {
        return (double) array_sum(array_map(function (CartItem $item) {
            return $item->getTotalPriceExcludingTax();
        }, $this->items));
    }

Usage Example

예제 #1
0
 public function calculateDiscount(Coupon $coupon, Cart $cart)
 {
     $config = $coupon->getConfig();
     $over = $config['over'];
     $percent = $config['percent'];
     $total = $cart->totalExcludingTax();
     if ($total > $over) {
         $discount = $total - $total * (1 - $percent / 100);
         $cart->setDiscount($discount);
     }
 }