protected function setSubtotal()
    {
        $this->subtotal = round($this->items->sum(function ($cartItem) {
            return $cartItem->price * $cartItem->quantity;
        }), 2);
    }
protected function setSubtotal()
    {
        $this->subtotal = round($this->items->sum(function ($cartItem) {
            return $cartItem->price * $cartItem->quantity;
        }), 2);
    }
protected function setSubtotal ( ) { $ this -> subtotal = round ( $ this -> items -> sum ( function ( $ cartItem ) { return $ cartItem -> price * $ cartItem -> quantity ; } ) , 2 ) ; }
Sets the subtotal of the cart.

@return void
Sets the subtotal of the cart .