public function changeLineItemQuantity($cartId, $lineItemId, $quantity) { $cart = $this->getCart($cartId); $cartUpdateRequest = CartUpdateRequest::ofIdAndVersion($cart->getId(), $cart->getVersion()); $cartUpdateRequest->addAction(CartChangeLineItemQuantityAction::ofLineItemIdAndQuantity($lineItemId, $quantity)); $this->profiler->enter($profile = new Profile('changeLineItem')); $cartResponse = $cartUpdateRequest->executeWithClient($this->client); $this->profiler->leave($profile); $cart = $cartUpdateRequest->mapResponse($cartResponse); return $cart; }
public function setShippingMethod($locale, $cartId, ShippingMethodReference $shippingMethod, $customerId = null) { $cart = $this->getCart($locale, $cartId, $customerId); $client = $this->getClient(); $cartUpdateRequest = CartUpdateRequest::ofIdAndVersion($cart->getId(), $cart->getVersion()); $shippingMethodAction = CartSetShippingMethodAction::of()->setShippingMethod($shippingMethod); $cartUpdateRequest->addAction($shippingMethodAction); $cartResponse = $cartUpdateRequest->executeWithClient($client); $cart = $cartUpdateRequest->mapFromResponse($cartResponse, $this->getMapper($locale)); return $cart; }