I have created these email templates with WooCommerce booster:
and am trying to manually send them off using this code. Everything works except the Custom_6 and Custom_7 emails.
<?php
add_action( 'woocommerce_thankyou', 'woocommerce_thankyou_change_order_status', 10, 1 );
function woocommerce_thankyou_change_order_status( $order_id ){
if( ! $order_id ) return;
$order = new WC_Order($order_id);
$payment_gateway = $order->get_payment_method();
if ($payment_gateway == 'invoice') {
$order->update_status('wc-pending-inv', 'order_note');
//sending emails
//customer
WC()->mailer()->get_emails()['WC_Email_WCJ_Custom_6']->trigger( $order_id );
//admin
WC()->mailer()->get_emails()['WC_Email_WCJ_Custom_7']->trigger( $order_id );
WC()->mailer()->get_emails()['WC_Email_Customer_Processing_Order']->trigger( $order_id );
}
}
?>
Unfortunately, the WC_Email_WJC_Custom_6 and 7 do not send emails, but the WC_Email_Customer_Processing_Order does. Am I missing anything here? Perhaps the trigger shouldn't be order id?
Cheers!
