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?
I think these hooks will help you
If you want an order id as parameter to your action hook callback function you can use
woocommerce_thankyou
hook.