From c070155ae55ed5e4231dc515472196915510f94c Mon Sep 17 00:00:00 2001 From: Aashwin Mohan <96258159+aashwin-rvvup@users.noreply.github.com> Date: Thu, 9 Jan 2025 17:41:54 +0000 Subject: [PATCH] Collect shipping rates before finding shipping rate (#236) --- Service/Shipping/ShippingMethodService.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Service/Shipping/ShippingMethodService.php b/Service/Shipping/ShippingMethodService.php index c4e2fbd5..c2061fce 100644 --- a/Service/Shipping/ShippingMethodService.php +++ b/Service/Shipping/ShippingMethodService.php @@ -110,14 +110,13 @@ public function setShippingMethodInQuote( return $quote; } + $shippingAddress->setShippingMethod($methodId)->setCollectShippingRates(true)->collectShippingRates(); $rate = $shippingAddress->getShippingRateByCode($methodId); - if ($rate == null) { + if ($rate === false) { $shippingAddress->setShippingMethod(''); return $quote; } - $shippingAddress->setShippingMethod($methodId)->setCollectShippingRates(true)->collectShippingRates(); - $this->shippingInformationManagement->saveAddressInformation( $quote->getId(), $this->shippingInformationFactory->create()