First impressions matter, especially in ecommerce. When a customer creates an account on your WooCommerce store, the “Your {site_title} account has been created!” welcome email is your golden opportunity to solidify a positive connection.
However, the standard WooCommerce email might fall short:
Hi Rodolfo,
Thanks for creating an account on {site_title}. Your username is ____. You can access your account area to view orders, change your password, and more at: ___
Click here to set your new password.
This tutorial teaches you how to display additional content in the “welcome” email. You can then personalize greetings, showcase your brand story, and strategically introduce features like exclusive offers or product recommendations. By tailoring these emails, you’ll not only provide valuable information but also nurture customer loyalty and encourage them to explore your offerings further.
Enjoy!
PHP Snippet: Add Content To The WooCommerce “New Account” Customer Email
The “New Account” email comes with no template hooks, unlike most of the order emails.
This means the only chance we have to inject our custom content is above the email footer – the hook is ‘woocommerce_email_footer‘ – with priority less than 10, because that’s when the footer is hooked by default.
So we will use priority 9:
add_action( 'woocommerce_email_footer', function( $email ) {
// do something
}, 9 );
After that, we need to identify if we’re on the correct email. Thankfully, we have the $email parameter, and we can check:
if ( $email instanceof WC_Email_Customer_New_Account ) {
// do something
}
Now we can echo any HTML content: paragraphs, images, links, and even get access to the customer details via PHP thanks to the $email object. Here’s the full code:
/**
* @snippet Add Content @ WooCommerce New Account Email
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @compatible WooCommerce 8
* @community https://businessbloomer.com/club/
*/
add_action( 'woocommerce_email_footer', 'bbloomer_add_content_new_account_email', 9 );
function bbloomer_add_content_new_account_email( $email ) {
if ( $email instanceof WC_Email_Customer_New_Account ) {
echo '<hr>';
echo '<h2>Some heading</h2>';
echo '<p>A paragraph, and an image below it</p>';
echo '<img src="banner.jpg">';
// $user_id = $email->object->ID; // get user ID
// $customer = new WC_Customer( $user_id ); // get customer object
// IF YOU HAVE A CUSTOM REGISTRATION FORM
// e.g. businessbloomer.com/shop/plugins/woocommerce-add-customer-fields-to-my-account-registration-form/
// YOU MAY ALREADY HAVE ACCESS TO:
$first_name = $customer->get_billing_first_name();
$last_name = $customer->get_billing_last_name();
$country = $customer->get_billing_country();
//etc.
}
}