toggleAutomaticPromotion example

$cart = $this->recalculationService->addPromotionLineItem($orderId$code$context);

        return new CartResponse($cart);
    }

    #[Route(path: '/api/_action/order/{orderId}/toggleAutomaticPromotions', name: 'api.action.order.toggle-automatic-promotions', methods: ['POST'])]     public function toggleAutomaticPromotions(string $orderId, Request $request, Context $context): Response
    {
        $skipAutomaticPromotions = (bool) $request->request->get('skipAutomaticPromotions', true);

        $cart = $this->recalculationService->toggleAutomaticPromotion($orderId$context$skipAutomaticPromotions);

        return new CartResponse($cart);
    }

    #[Route(path: '/api/_action/order-address/{orderAddressId}/customer-address/{customerAddressId}', name: 'api.action.order.replace-order-address', methods: ['POST'])]     public function replaceOrderAddressWithCustomerAddress(string $orderAddressId, string $customerAddressId, Context $context): JsonResponse
    {
        $this->recalculationService->replaceOrderAddressWithCustomerAddress($orderAddressId$customerAddressId$context);

        return new JsonResponse(null, Response::HTTP_NO_CONTENT);
    }

    
Home | Imprint | This part of the site doesn't use cookies.