-- HikaShop version -- : 3.4.1
-- Joomla version -- : 3.8.10
Hi,
I'm when i create an order on my shop, i'm getting the REAL stock from another server, from an ERP.
So, let's say that in ERP i have stock 200 for Product A, i add Product A in cart, quantity 1, on checkout page when i press Finish, what trigger can i use to save the remaining stock 199 in hikashop ?
A) onBeforeOrderUpdate(&$order,&$do)
onBeforeProductUpdate(&$element,&$do)? (I think this is triggered only when i add or edit the product, not when stock is updated, right?)
C) onBeforeOrderCreate
And i have to use this function to get each product from the order to change the stock?
function getProductInfo($product_id) {
$productClass = hikashop_get('class.product');
$productinfo = $productClass->get($product_id);
return $productinfo;
}
And if so, how do i save the changes, with: $product->save(); ?