$originalShippingMethod =
$salesChannelContext->
getShippingMethod();
if (!
$this->
shippingMethodBlocked($errors)) { return $originalShippingMethod;
} $shippingMethod =
$this->
getShippingMethodToChangeTo($errors,
$salesChannelContext);
if ($shippingMethod === null
) { return $originalShippingMethod;
} $this->
addNoticeToCart($errors,
$shippingMethod);
return $shippingMethod;
} private function shippingMethodBlocked(ErrorCollection
$cartErrors): bool
{ foreach ($cartErrors as $error) { if ($error instanceof ShippingMethodBlockedError
) { return true;
} }