I am trying to find a hook for Woocommerce wherein I can "ping" the woocommerce system that a unit/s of a particular product was "sold" without having to create the order inside woocommerce.
I have an external service which "reduces" stock (in woocommerce) without recording the order in woocommerce.
I want to append an additional code to this function so that some of the other functions can be "triggered".
I have tried using :
$new_quantity = wc_update_product_stock( $product, $quantity_purchased, 'decrease');
$new_quantity = wc_update_product_stock( $product, $newstock);
$newstock is updated quantity and $quantity_purchased is unit sold. I tried "reducing" stock using native woocommerce hook and then resetting it back to the actual quantity.
It did work (as it is meant to be) but did not fire the other functions.
I want to trigger all the functions that are supposed to trigger when a product sells. For example, the total_sales Custom Field, which is native woocommerce custom field to increase/decrease per the sale quantity (which doesn't happen currently).
ALL THIS without having to create the Woocommerce order.