Working on a plugin for Wordpress + Woocommerce. Trying to run a function after order is placed and saved. Tried:
Tried priority:
What I'm doing:
add_action('woocommerce_checkout_order_processed', 'func_do_my_magic', 10,1)
function func_do_my_magic($order_id) {
//Do my magic here using $order_id
}
What I'm expecting:
The magic to be done on each new order placed
What is happening:
The magic is done when the user placing the order is already logged-in, the magic is not done for guest orders or orders from users not logged-in
Any ideas on why?
Thanks on advance
add_action('woocommerce_order_status_processing', 'custom_process_order', 10, 1);
function custom_process_order($order_id){
//do some your magic here
}
Try this code..