Answer the question
In order to leave comments, you need to log in
What causes the error "There are not enough unallocated items in the cart"?
It is not possible to change the delivery amount through the CSaleOrder::Update() function, the error "Insufficient amount of unallocated goods in the basket" appears. What could be causing the error?
Answer the question
In order to leave comments, you need to log in
This error occurs when there is a change in the quantity in the basket associated with the order, but the order itself has not been saved. At D7, this moment is solved as follows:
Bitrix\Main\Loader::includeModule("sale");
create an order instance
$order = Order::load($orderId);
get the basket
$basket = $order->getBasket();
change the quantity
foreach ($basketItems as $basketItem) {
$basketItem->setField('QUANTITY', 10); // here we enter the required quantity for the desired product
}
save the basket
$basket->save();
overwrite data in order
$order->refreshData();
save the order
$order->save();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question