public function removeInvalidShippingMethod(CartOnLoadEvent $event)
{
$cart = $event->getCart();
$cartShippingMethodId = $cart->getShippingMethod();
if (null === $cartShippingMethodId) {
return $this;
}
$shippingMethod = $this->shippingWrapper->getOneById($cart, $cartShippingMethodId);
if (!$shippingMethod instanceof ShippingMethod) {
$cart->setShippingMethod(null);
$this->cartEventDispatcher->dispatchCartLoadEvents($cart);
$event->stopPropagation();
}
return $this;
}