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?


3 Answers 3


Why is it so hard to find a list of woocommerce hooks per page or sequence of execution or order > payment flow?

Anyway, after hours and hours of searching:

add_action( 'woocommerce_before_pay_action', 'Your Function', 1, 1 );
  • Thanks, searched a lot for this too...
    – Webdever
    Commented Oct 26, 2022 at 13:17

This worked for me

add_action( 'woocommerce_before_checkout_process', 'fireBeforeCheckout', 10, 1 );

This is the best hook that u can use, this hook launch after last checkout process before redirect user to payment gateway (paying)

add_action( 'woocommerce_checkout_order_processed', 'callback_function' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.