0

I would like to update quote from a order.

When I update qty of a item from quotes it make correct subtotal and tax.

However, when I update great than 2 items then subtotal and tax get last data of this items.(only first item correct) There is my code:

foreach ($quote->getAllVisibleItems() as $quoteItem) {

        if($id != $quoteItem->getId()) continue;
        $existData = $order->getItemByQuoteItemId($quoteItem->getId());
        if ($existData) {
            $quoteItem->setItemId()->setQty($qty)->save();
            $quote->collectTotals();
            $orderItem = $this->toOrderItem->convert($quoteItem);
            $existData->addData($orderItem->getData());
        }
    } 
$quote->collectTotals();
$quote->save();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.