I need to update multiple cart items quantity in Rest API.

Default Magento only have update single cart item.

Single cart update Item endpoint:


I have tried with custom endpoint but not get update multiple items.

Multiple item custom endpoint:



cartItem[0][item_id]   85411
cartItem[0][qty]       2
cartItem[0][quote_id]  25645
cartItem[1][item_id]   85412
cartItem[1][qty]       1
cartItem[1][quote_id]  25645

Method: PUT

Let me know if any have idea about to update multiple cart items in rest API.

Any help would be appreciated. Thanks.

1 Answer 1


call the items in the loop and load quote object and set quantity or another field.

sample code

 public function updateItems($cartId, $cartItem)
   $result = $this->dataObjectFactory->create();
   $quote = $this->quoteRepository->getActive($cartId);        
   foreach ($cartItem as $itemValue) {
     $item = $this->quoteItemFactory->create()->load($itemValue['item_id']);
     $item = $quote->getItemById($itemValue['item_id']);
     $quoteItems[] = $item;

Please let me know if this is helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.