11 use Psr\Log\LoggerInterface as Logger;
50 private $shippingAddressAssignment;
80 $quote->removeAddress(
$quote->getBillingAddress()->getId());
83 $this->getShippingAddressAssignment()->setAddress(
$quote,
$address, $useForShipping);
84 $quote->setDataChanges(
true);
85 $this->quoteRepository->save(
$quote);
86 }
catch (\Exception $e) {
87 $this->logger->critical($e);
88 throw new InputException(
__(
'The address failed to save. Verify the address and try again.'));
90 return $quote->getBillingAddress()->getId();
99 return $cart->getBillingAddress();
106 private function getShippingAddressAssignment()
108 if (!$this->shippingAddressAssignment) {
110 ->get(\
Magento\
Quote\Model\ShippingAddressAssignment::class);
112 return $this->shippingAddressAssignment;
__construct(\Magento\Quote\Api\CartRepositoryInterface $quoteRepository, QuoteAddressValidator $addressValidator, Logger $logger, \Magento\Customer\Api\AddressRepositoryInterface $addressRepository)
assign($cartId, \Magento\Quote\Api\Data\AddressInterface $address, $useForShipping=false)