43 private $cartItemOptionsProcessor;
74 $item = $this->getCartItemOptionsProcessor()->addProductOptions(
$item->getProductType(),
$item);
75 $output[] = $this->getCartItemOptionsProcessor()->applyCustomOptions(
$item);
89 $quoteItems =
$quote->getItems();
91 $quote->setItems($quoteItems);
92 $this->quoteRepository->save(
$quote);
94 return $quote->getLastAddedItem();
106 throw new NoSuchEntityException(
107 __(
'The %1 Cart doesn\'t contain the %2 item.',
$cartId, $itemId)
111 $quote->removeItem($itemId);
112 $this->quoteRepository->save(
$quote);
113 }
catch (\Exception $e) {
114 throw new CouldNotSaveException(
__(
"The item couldn't be removed from the quote."));
124 private function getCartItemOptionsProcessor()
126 if (!$this->cartItemOptionsProcessor instanceof CartItemOptionsProcessor) {
130 return $this->cartItemOptionsProcessor;
save(\Magento\Quote\Api\Data\CartItemInterface $cartItem)
__construct(\Magento\Quote\Api\CartRepositoryInterface $quoteRepository, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Quote\Api\Data\CartItemInterfaceFactory $itemDataFactory, array $cartItemProcessors=[])
deleteById($cartId, $itemId)