Custom Woocommerce email using woocommerce_email_actions hook

Most of my plugins are Woocommerce based, and many use the Woocommerce Class WC_EMAIL to sent out emails. Recently I started getting complaints about emails not being sent. After some troubleshooting, I found that adding the email trigger action was not getting added to the active array. I google around and found a new hook that I can use a filter woocommerce_email_actions. Simple replace
add_filter( 'woocommerce_init', array( $this, 'my_email_actions' ) );
public function my_email_actions() {
add_action( 'class_my_email_send', array( 'WC_Emails', 'send_transactional_email' ), 10, 1 );
}

with
add_filter( 'woocommerce_email_actions', array( $this, 'my_email_actions' ) );

public function my_email_actions() {
$email_actions[] = 'class_my_email_send';
return $email_actions;
}

Leave a Reply

Your email address will not be published. Required fields are marked *