如何在注册后将WooCommerce客户详细信息(姓名、电子邮件和电话号码)发送给Admin

时间:2020-01-29 作者:iPankajS

Use case:
每当有人在我的Woocommerce商店注册为客户时,我想向管理员或销售人员发送电子邮件通知
我想包括的详细信息:姓名、电话号码、电子邮件地址

注册时我已经记下了电话号码billing_phone

Issue
下面提到的代码片段仅发送电子邮件地址。不是名字或电话号码。


我想将电话号码、电子邮件和姓名发送给任何给定的员工电子邮件。你能帮我做这个吗?

    function so174837_registration_email_alert( $user_id ) {
    $user    = get_userdata( $user_id );
    $email   = $user->user_email;
      $name   = $user->user_email;
    $phone = get_user_meta( $customer_id, \'billing_phone\', true );
    $message = $name.\'\'.$email .\' - \' .$phone. \'has registered to your website.\';
    $subject1= $name. \' - \'.$phone .\'just signed up. Call him.\';
    wp_mail( \'xxy@gmail.com\', $subject1, $message );
}add_action(\'user_register\', \'so174837_registration_email_alert\');

1 个回复
SO网友:Glauber

尝试更改此选项:$name = $user->user_email; 对此:

$name = $user->first_name;
还有这个:$phone = get_user_meta( $customer_id, \'billing_phone\', true ); 对此:

$phone = get_user_meta( $user_id, \'billing_phone\', true );
对你有用吗?让我知道!=)