2
votes

I need to send the order confirmation E-Mail within Woocommerce to the store owner via a php function. I want to hook it to the following:

add_action( 'woocommerce_thankyou', '####', 55 );

But I don't know which funktion to call to fire the email? The E-Mail template is stored in the following directory and is called: woocommerce/templates/emails/admin-new-order.php Could you help me with this?

If you need any more details please leave a comment! Thanks!

1

1 Answers

2
votes

Use the following:

add_action( 'woocommerce_thankyou', function( $order_id){
    WC()->mailer()->get_emails()['WC_Email_New_Order']->trigger( $order_id );
}, 55 );

Code goes in functions.php file of the active child theme (or active theme).

Since WooCommerce 5+: Allow re-sending New Order Notification in WooCommerce 5+