getNewShippingMethodName example

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([
                [
                    'id' => $salesChannelId,
                    
parent::__construct($this->message);
    }

    public function isPersistent(): bool
    {
        return true;
    }

    public function getParameters(): array
    {
        return [
            'newShippingMethodName' => $this->getNewShippingMethodName(),
            'oldShippingMethodName' => $this->getOldShippingMethodName(),
        ];
    }

    public function blockOrder(): bool
    {
        return false;
    }

    public function getId(): string
    {
        
Home | Imprint | This part of the site doesn't use cookies.