/** * Get item price (with or without VAT based on _pricesWithVat setting) * * @param CartItemInterface item * @param int quantity (null to use item quantity) * @param bool count price with VAT (null to use cart default) * @param int rounding decimals (null to use cart default) * @return \Litipk\BigNumbers\Decimal */ public function getItemPrice(CartItemInterface $item, $quantity = null, $pricesWithVat = null, $roundingDecimals = null) { $item->setCartContext($this->_context); return $this->countPrice($item->getUnitPrice(), $item->getTaxRate(), $quantity ?: $item->getCartQuantity(), $pricesWithVat, $roundingDecimals); }
/** * Add item to cart * * @param CartItemInterface item * @param int quantity * @return void */ public function addItem(CartItemInterface $item, $quantity = 1) { if (isset($this->_items[$item->getCartId()])) { $quantity += $this->_items[$item->getCartId()]->getCartQuantity(); } $item->setCartQuantity($quantity); $item->setCartContext($this->_context); $this->_items[$item->getCartId()] = $item; $this->_totals = null; }