ShippingMethodRouteHook example


        return $this->decorated;
    }

    #[Route(path: '/store-api/shipping-method', name: 'store-api.shipping.method', methods: ['GET', 'POST'], defaults: ['_entity' => 'shipping_method'])]     public function load(Request $request, SalesChannelContext $context, Criteria $criteria): ShippingMethodRouteResponse
    {
        $response = $this->getDecorated()->load($request$context$criteria);

        $response->getShippingMethods()->sortShippingMethodsByPreference($context);

        $this->scriptExecutor->execute(new ShippingMethodRouteHook(
            $response->getShippingMethods(),
            $request->query->getBoolean('onlyAvailable') || $request->request->getBoolean('onlyAvailable'),
            $context
        ));

        return $response;
    }
}
Home | Imprint | This part of the site doesn't use cookies.