A
A
Alexer052019-09-13 12:13:45
1C-Bitrix
Alexer05, 2019-09-13 12:13:45

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

1 answer(s)
U
usvmak, 2022-04-12
@usvmak

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 question

Ask a Question

731 491 924 answers to any question