Error
$error,
KernelBrowser
$browser,
string
$salesChannelId,
string
$productId,
bool
$shouldSwitchToDefault ): void
{ $availabilityRuleId =
$this->
createAvailabilityRule($salesChannelId);
$salesChannelRepository =
$this->
getContainer()->
get('sales_channel.repository'
);
if ($error instanceof ShippingMethodChangedError
) { $shippingMethodRepository =
$this->
getContainer()->
get('shipping_method.repository'
);
$blockedId =
$this->
getShippingMethodIdByName($error->
getOldShippingMethodName());
$newId =
$this->
getShippingMethodIdByName($error->
getNewShippingMethodName());
$shippingMethodRepository->
update([ [ 'id' =>
$blockedId,
'availabilityRuleId' =>
$availabilityRuleId,
],
], Context::
createDefaultContext());
$salesChannelRepository->
update([ [