WordPress : woocommerce action hook to run before payment gateway redirect

I am newbie to WordPress and I want to run a function before payment gateway redirection in woo commerce.

add_action('woocommerce_checkout_order_processed', 'initiate_order', 10, 1);

function initiate_order($order_id) {
    include('woocommerce/includes/emails/class-wc-email-admin-initiate-order.php');
    $email = new WC_Email_Admin_Initiate_Order();
    $email->trigger($order_id->id);
}

How can I initiate a mail to admin about the order before payment gateway redirection?

Related posts

2 comments

  1. If you want an order id as parameter to your action hook callback function you can use woocommerce_thankyou hook.

Comments are closed.