Hey there WooCommerce experts,
I am trying now for hours, but no idea what’s wrong.
I simply want to send the WC_Email_New_Order mail manually via source code. I am using this code:
$post_id=346;
$order = wc_get_order( $post_id );
$mailer = WC()->mailer();
$email = $mailer->emails['WC_Email_New_Order'];
$email->trigger( $order->get_id(), $order );
Nothing happens.
When using the same code for WC_Email_New_Order everything works fine:
$post_id = 346; // Order ID
$order = wc_get_order($post_id);
$mailer = WC()->mailer();
$email = $mailer->emails['WC_Email_Customer_Completed_Order'];
$email->trigger($order->get_id(), $order);
Also when sending WC_Email_New_Order again via order details in WordPress backend. So mail configuration, template and recipient are okay.
Any ideas what could be wrong here? ??