New Account email – Insert First Name
-
Hi,
I am a newbie trying to learn. I am on Woocommerce 3.0.6 with Flatsome Theme
I have copied the woocommerce email templates into my child theme folder and I am editing them there.
I am trying to insert Customer’s first name in all emails and have succeeded in order emails by using the below code:
<p><?php printf( __( “Hello %s”, ‘woocommerce’ ), $order->billing_first_name ); ?></p>
I even managed to modify the New Account Email to get the customer email rather than his account name using the code below:
// load customer data and user email into email template $user_email = $user_login; $user = get_user_by('login', $user_login); if ( $user ) { $user_email = $user->user_email; } if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } ?> <?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?> <p><?php printf( __( 'Hello %s,', 'woocommerce' ), esc_html($billing_first_name )); ?></p> <p><?php printf( __( 'Thanks for creating an account on %1$s. <br><br> Your username has been set as %2$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_email ) . '</strong>' ); ?></p>}
However, this code is not working in New Account Email to populate the First Name.
It would be great if anyone can guide me with the required code to get the Customer’s First name into the New Account Email.
P.S. Please do not suggest to install any plugin. I would rather learn with your expert guidance.
Thanks a lot!
- The topic ‘New Account email – Insert First Name’ is closed to new replies.