Use case:
I want to send an email notification to the admin or the sales staff whenever someone signup as customer on my Woocommerce Shop.
Details I want to include: Name, Phone Number, Email Address.
I'm already taking phone number while registration as billing_phone
Issue
The snippet mentioned below sends email address only. Not the NAME or the Phone Number.
I want send the Phone number, email and name to the any given email of the staff. Can you help me with this?
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( '[email protected]', $subject1, $message );
}add_action('user_register', 'so174837_registration_email_alert');
Use case:
I want to send an email notification to the admin or the sales staff whenever someone signup as customer on my Woocommerce Shop.
Details I want to include: Name, Phone Number, Email Address.
I'm already taking phone number while registration as billing_phone
Issue
The snippet mentioned below sends email address only. Not the NAME or the Phone Number.
I want send the Phone number, email and name to the any given email of the staff. Can you help me with this?
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( '[email protected]', $subject1, $message );
}add_action('user_register', 'so174837_registration_email_alert');
Share
Improve this question
asked Jan 29, 2020 at 15:45
iPankajSiPankajS
1
1 Answer
Reset to default 0Try changing this: $name = $user->user_email; to this:
$name = $user->first_name;
And this: $phone = get_user_meta( $customer_id, 'billing_phone', true ); to this:
$phone = get_user_meta( $user_id, 'billing_phone', true );
Did it work for you? Let me know! =)