Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Last active June 9, 2022 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webtoffee-git/764c655c78fb520bcdf0acd6f33a0cf0 to your computer and use it in GitHub Desktop.
Save webtoffee-git/764c655c78fb520bcdf0acd6f33a0cf0 to your computer and use it in GitHub Desktop.
Send custom email content for new WooCommerce Users-Users Import export
<?php
add_filter('wt_user_registration_email', 'wt_user_registration_email');
function wt_user_registration_email($mail_attrs)
{
$user = get_user_by('id', $mail_attrs['user_id']);
$first_name = $user->first_name;
$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$user_login = $user->user_login;
$password = $mail_attrs['password'];
$subject = 'Your account has been created!';//please change mail subject
$mail_body = "Hi ".$first_name.",
Thanks for creating an account on ".$blog_name." . Your username is ".$user_login." . You can access your account area to view orders, change your password.
Your password has been generated: ".$password."
We look forward to seeing you soon.
".$blog_name;//please change mail body
$mail_attrs['subject'] = $subject;
$mail_attrs['body'] = nl2br($mail_body);
return $mail_attrs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment