From d60ad9781b6229d0ad15bfae344f37ffbd06c165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Sch=C3=A4fer?= Date: Thu, 14 Nov 2019 15:10:03 +0100 Subject: [PATCH] Fixed country setting for shipping address This fixes the following use case: - customer goes to checkout and enters an address with different country than the auto shipping country but does not purchase - customer goes back to a product and checks out using the PayPalExpress button - the address of the existing quote is taken and transferred to PayPal, but the country is changed to the auto shipping country - if the customer does not check the address again, he checks out with a completely wrong country --- .../community/IntegerNet/Autoshipping/Model/Observer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/community/IntegerNet/Autoshipping/Model/Observer.php b/app/code/community/IntegerNet/Autoshipping/Model/Observer.php index a1b26ee..481b562 100644 --- a/app/code/community/IntegerNet/Autoshipping/Model/Observer.php +++ b/app/code/community/IntegerNet/Autoshipping/Model/Observer.php @@ -40,8 +40,10 @@ public function prepareShippingAddress(Varien_Event_Observer $observer) } $shippingAddress = $quote->getShippingAddress(); - $shippingAddress->setCountryId($country); - + if (!$shippingAddress->getCountryId()) { + $shippingAddress->setCountryId($country); + } + if (!$shippingAddress->getFreeMethodWeight()) { $shippingAddress->setFreeMethodWeight($shippingAddress->getWeight()); }