I need a function to execute add_new_user_details within my Woocommerce site but am struggling applying the relevant hook. I need to execute it after a new user places an order and adds billing info etc.
When I test the below by completing an order, it doesn’t seem to doing anything. I have tried using ‘woocommerce_order_status_processing’ and ‘user_register’ hooks.
add_action( 'woocommerce_order_status_complete', 'add_new_user_details' );
function add_new_user_details($user_id){
$user_id = get_current_user_id();
echo $user_id;
}
you could try the woocommerce_checkout_process hook which, I think, fires after the checkout form is posted. http://oik-plugins.eu/woocommerce-a2z/oik_hook/woocommerce_checkout_process/