没有要挂钩的操作/筛选器。您需要覆盖标准WC_Email_Customer_New_Account
类并实现您自己的逻辑。要做到这一点,您需要创建自己的类,该类将继承该类并注册它。
class WPSE8170_Email_Customer_New_Account extends WC_Email_Customer_New_Account {
function trigger( $user_id, $user_pass = \'\', $password_generated = false ) {
// do what you need here and then call parent method
parent::trigger( $user_id, $user_pass, $password_generated );
}
}
现在您需要注册此类:
add_filter( \'woocommerce_email_classes\', \'wpse8170_update_email_classes\' );
function wpse8170_update_email_classes( $emails ) {
$emails[\'WC_Email_Customer_New_Account\'] = new WPSE8170_Email_Customer_New_Account();
return $emails;
}