我试图在任何用户通过WooCommerce注册时向管理员帐户发送自定义电子邮件。我已经设法让它发送用户名($user_login)
但未能向管理员提供客户电子邮件和姓名等信息。我有什么明显的遗漏吗?
这是我的习惯customer-new-account.php
文件:
<?php do_action( \'new_customer_registered\', $user_login, $user_email ); ?>
这是我的
functions.php
:
//email admin on new customer sign up
function new_customer_registered_send_email_admin($user_login, $user_email) {
ob_start();
do_action(\'woocommerce_email_header\', \'New customer registered\');
$email_header = ob_get_clean();
ob_start();
do_action(\'woocommerce_email_footer\');
$email_footer = ob_get_clean();
woocommerce_mail(
get_bloginfo(\'admin_email\'),
get_bloginfo(\'name\').\' - New customer registered\',
$email_header.\'<p>The user \'.esc_html( $user_login ).\' created an account on the website.<br>Email:\'.esc_html( $user_email ).\'</p>\'.$email_footer
);
}
add_action(\'new_customer_registered\', \'new_customer_registered_send_email_admin\');