Answer the question
In order to leave comments, you need to log in
How to take a reserve from a product via API?
Good afternoon!
The item is placed into the reserve using standard Bitrix tools.
How can I remove it from the reserve through the API?
There is a link but it didn't work for me. I don't understand how to use \Bitrix\Catalog\Product\CatalogProvider
Answer the question
In order to leave comments, you need to log in
Wow what did it cost
me
//резервирование товара
$productId = 12;
$a = new \Bitrix\Catalog\Product\CatalogProvider;
$resReserve = $a->reserve(array(
$productId => ["PRODUCT_ID" => $productId, "QUANTITY" => 15]
));
//снятие резерва
//для снятия резерва ВАЖНО чтобы QUANTITY был ОТРИЦАТЕЛЬНЫЙ
$a = new \Bitrix\Catalog\Product\CatalogProvider;
$resReserve = $a->reserve(array(
$productId => ["PRODUCT_ID" => $productId, "QUANTITY" => -15 ]
));
The method by reference is not about that, it simply returns information, but it must be changed. https://dev.1c-bitrix.ru/api_help/catalog/classes/... is more suitable here
instead
of CCatalogProductProvider::ReserveProduct($arParams);
Use
\Bitrix\Catalog\Product\CatalogProvider::ReserveProduct($arParams);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question