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 changeLineItemQuantity($locale, $cartId, $lineItemId, $quantity, $customerId = null) { $cart = $this->getCart($locale, $cartId, $customerId); $client = $this->getClient(); $cartUpdateRequest = CartUpdateRequest::ofIdAndVersion($cart->getId(), $cart->getVersion()); $cartUpdateRequest->addAction(CartChangeLineItemQuantityAction::ofLineItemIdAndQuantity($lineItemId, $quantity)); $cartResponse = $cartUpdateRequest->executeWithClient($client); $cart = $cartUpdateRequest->mapFromResponse($cartResponse, $this->getMapper($locale)); $this->session->set(self::CART_ITEM_COUNT, $cart->getLineItemCount()); return $cart; }