In WooCommerce I create orders and users by code and on the 'order-pay' endpoint a user is created by form + ajax. The 'proceed to checkout' button is disabled by jQuery until the user is created. Now I want to create a server side check. So trying to run a function after submit but before the redirect to the payment gateway.
I've tried these hooks but they all don't work for me in this case (do nothing).
add_action( 'woocommerce_before_checkout_process', 'is_user_created' , 1, 1 );
add_action( 'woocommerce_new_order', 'is_user_created' , 1, 1 );
add_action( 'woocommerce_checkout_process', 'is_user_created' , 1, 1 );
add_action( 'woocommerce_checkout_order_processed', 'is_user_created' , 1, 1 );
add_action( 'woocommerce_check_cart_items', 'is_user_created' , 1, 1 );
add_action( 'woocommerce_review_order_after_submit', 'is_user_created' , 1, 1 );
The function used to test is:
function is_user_created( $order_id ){
die ('No account created');
}
Any ideas?