- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Friends,
I am facing 1 issue after successfull order my new shipping and billing address is not getting stored in user address book. As i check new shipping and billing address are coming in order detail view page.
So can you please reply what can be the issue for which address are not getting stored.
This issue is only coming for existing user. For new user its working good
Please reply asap.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Nuhe
Please override below file in custom module and replace with below savePaymentInformation function.
/vendor/magento/module-checkout/Model/PaymentInformationManagement.php
public function savePaymentInformation( $cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, \Magento\Quote\Api\Data\AddressInterface $billingAddress = null ) { if ($billingAddress) { /** @var \Magento\Quote\Api\CartRepositoryInterface $quoteRepository */ $quoteRepository = $this->getCartRepository(); /** @var \Magento\Quote\Model\Quote $quote */ $quote = $quoteRepository->getActive($cartId); $quote->removeAddress($quote->getBillingAddress()->getId()); $customer = $quote->getCustomer(); if (is_null($customer->getDefaultBilling())) { $customer->setDefaultBilling($billingAddress->getId()); } $quote->setBillingAddress($billingAddress); $quote->setDataChanges(true); $shippingAddress = $quote->getShippingAddress(); if ($shippingAddress && $shippingAddress->getShippingMethod()) { $shippingDataArray = explode('_', $shippingAddress->getShippingMethod()); $shippingCarrier = array_shift($shippingDataArray); $shippingAddress->setLimitCarrier($shippingCarrier); } } $this->paymentMethodManagement->set($cartId, $paymentMethod); return true; }
If issue solved , Click Kudos & Accept as Solution
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Nuhe
Please override below file in custom module and replace with below savePaymentInformation function.
/vendor/magento/module-checkout/Model/PaymentInformationManagement.php
public function savePaymentInformation( $cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, \Magento\Quote\Api\Data\AddressInterface $billingAddress = null ) { if ($billingAddress) { /** @var \Magento\Quote\Api\CartRepositoryInterface $quoteRepository */ $quoteRepository = $this->getCartRepository(); /** @var \Magento\Quote\Model\Quote $quote */ $quote = $quoteRepository->getActive($cartId); $quote->removeAddress($quote->getBillingAddress()->getId()); $customer = $quote->getCustomer(); if (is_null($customer->getDefaultBilling())) { $customer->setDefaultBilling($billingAddress->getId()); } $quote->setBillingAddress($billingAddress); $quote->setDataChanges(true); $shippingAddress = $quote->getShippingAddress(); if ($shippingAddress && $shippingAddress->getShippingMethod()) { $shippingDataArray = explode('_', $shippingAddress->getShippingMethod()); $shippingCarrier = array_shift($shippingDataArray); $shippingAddress->setLimitCarrier($shippingCarrier); } } $this->paymentMethodManagement->set($cartId, $paymentMethod); return true; }
If issue solved , Click Kudos & Accept as Solution
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: New Shiping and Billing Address
Hello mate,
Thanks for reply i changed the code but the issue is same mate not saving the new billing and shipping address for existing user.
Please reply if anything more to do
Thanks