i am using following code for Woocommerce Product publish, update hook and it’s work perfect for me :
add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 );
function filter_post_data( $data , $postarr ) {
$sum = $_POST['wpcf']['ptchq'] + $_POST['wpcf']['monivong'];
$_POST['_stock'] = $sum;
return $data;
}
i am add two custom text field and add that field sum in product stock quantity in admin side.
Now my question is that how can i get after order complete reduce stock quantity action hook. so using that hook i can reduce stock in my custom field in admin side product.
Thanks,
Ketan.
The hook that runs when stock is changed is
You can see it in the Product Abstract