Esempio n. 1
0
 /**
  * @param CartInterface $quote
  * @return CartInterface
  *
  * @throws InputException
  * @throws \Magento\Framework\Exception\CouldNotSaveException
  * @throws \Magento\Framework\Exception\LocalizedException
  * @throws \Magento\Framework\Exception\NoSuchEntityException
  */
 public function save(CartInterface $quote)
 {
     /** @var \Magento\Quote\Model\Quote $quote */
     // Quote Item processing
     $items = $quote->getItems();
     if ($items) {
         foreach ($items as $item) {
             /** @var \Magento\Quote\Model\Quote\Item $item */
             if (!$item->isDeleted()) {
                 $quote->setLastAddedItem($this->cartItemPersister->save($quote, $item));
             }
         }
     }
     // Billing Address processing
     $billingAddress = $quote->getBillingAddress();
     if ($billingAddress) {
         $this->billingAddressPersister->save($quote, $billingAddress);
     }
     $this->processShippingAssignment($quote);
     $this->quoteResourceModel->save($quote->collectTotals());
     return $quote;
 }