Skip to content

Commit 4925c1f

Browse files
authored
Fix missing scope on isShippingCarrierAvailable
The scope to isShippingCarrierAvailable is not applied from $request. This makes issues with shipping methods when quote is being created from backend via 3rd party modules. This applies storeId scope directly from $request->getStoreId() to make sure scope is not lost when quote is created by admin.
1 parent 2e45de7 commit 4925c1f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/code/Magento/Shipping/Model/Shipping.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $req
273273
*/
274274
private function prepareCarrier(string $carrierCode, RateRequest $request): AbstractCarrier
275275
{
276-
$carrier = $this->isShippingCarrierAvailable($carrierCode)
276+
$carrier = $this->isShippingCarrierAvailable($carrierCode, $request->getStoreId())
277277
? $this->_carrierFactory->create($carrierCode, $request->getStoreId())
278278
: null;
279279
if (!$carrier) {
@@ -541,13 +541,15 @@ public function setCarrierAvailabilityConfigField($code = 'active')
541541
* Checks availability of carrier.
542542
*
543543
* @param string $carrierCode
544+
* @param null|int $storeId
544545
* @return bool
545546
*/
546-
private function isShippingCarrierAvailable(string $carrierCode): bool
547+
private function isShippingCarrierAvailable(string $carrierCode, ?int $storeId = null): bool
547548
{
548549
return $this->_scopeConfig->isSetFlag(
549550
'carriers/' . $carrierCode . '/' . $this->_availabilityConfigField,
550-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
551+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
552+
$storeId
551553
);
552554
}
553555
}

0 commit comments

Comments
 (0)