/** * Load cart products prices. * * @param CartInterface $cart Cart */ public function loadCartProductsAmount(CartInterface $cart) { $currency = $this->currencyWrapper->get(); $productAmount = Money::create(0, $currency); /** * Calculate Amount and ProductAmount. */ foreach ($cart->getCartLines() as $cartLine) { /** * @var CartLineInterface $cartLine */ $cartLine = $this->loadCartLinePrices($cartLine); /** * @var MoneyInterface $productAmount * @var MoneyInterface $totalAmount */ $convertedProductAmount = $this->currencyConverter->convertMoney($cartLine->getProductAmount(), $currency); $productAmount = $productAmount->add($convertedProductAmount->multiply($cartLine->getQuantity())); } $cart->setProductAmount($productAmount); }