Skip to content
Advertisement

Get the user email in Woocommerce “New account” email notification template

In Woocommerce I am trying to customize the “New account” email notification template changing the texts.

Currently the default template shows the username but intead I want it to show the user email.

I thought I needed to use something like $user_email but that shows up blank (or empty).

How to get the user email in Woocommerce “New account” email notification template?

That is the customized template that I got where I need to get the user email:

JavaScript

Advertisement

Answer

In this template, the $user_login is defined and available. What you can do is to use the WordPress function get_user_by() with it to get the user email.

So in the template you will have just to replace this line:

JavaScript

By this instead:

JavaScript

This way you will be sure to don’t get any error and you will have the default woocommerce alternative.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement