Заменил код функции следующим:
function productUpdateInBasket($prodId=0,$QUANTITY=0) {
if ($prodId == 0) {return false;}
$basket = \Bitrix\Sale\Basket::loadItemsForFUser(\Bitrix\Sale\Fuser::getId(CSaleBasket::GetBasketUserID()), \Bitrix\Main\Context::getCurrent()->getSite());
$basket->refresh();
$dbRes = \Bitrix\Sale\Basket::getList(array(
"select"=>["PRODUCT_ID","NAME","QUANTITY","ID"],
"filter"=>array(
"=FUSER_ID"=>\Bitrix\Sale\Fuser::getId(),
"=ORDER_ID" => null,
"=LID"=>\Bitrix\Main\Context::getCurrent()->getSite(),
"=CAN_BUY"=>"Y",
"=PRODUCT_ID"=>$prodId
)
));
$itemId = false;
while ($item = $dbRes->fetch()) {
if (isset($item["ID"]) and $item["ID"] and isset($item["PRODUCT_ID"]) and ($item["PRODUCT_ID"] == $prodId)) {
$itemId = $item["ID"];
}
}
if ($itemId) {
$itemProd = $basket->getItemById($itemId);
if ($QUANTITY==0) {
$itemProd->delete();
} else {
$itemProd->setField("QUANTITY",$QUANTITY);
}
$basket->save();
$basket->refresh();
return true;
}
return false;
}
Так ещё инфа с примерами кода по ситуации тут
blog.ivru.net/?id=51