Skip to content

Commit

Permalink
Collect shipping rates before finding shipping rate (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
aashwin-rvvup authored Jan 9, 2025
1 parent 55128b6 commit c070155
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Service/Shipping/ShippingMethodService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit c070155

Please sign in to comment.