• Hi,

    I want to trigger the New Account email template from WooCommerce when adding a new user via WP admin section.

    For that purpose, I have simply written the following in functions.php:

    add_filter( 'wp_new_user_notification_email', 'mysite_wp_new_user_notification_email', 10, 3 );
    function mysite_wp_new_user_notification_email( $wp_new_user_notification_email, $user, $blogname ) {
    	if (class_exists('WooCommerce') && $user) {
    		$wc = new WC_Emails();
    		$wc->customer_new_account($user->id);
            }
    	return;
    }

    It works fine, the WC New Account email is sent instead of the default new user notification of WP, except that the header and footer are duplicated in the email being sent out. If I look at source code of the email, both headers and footers are declared twice.

    Any clue on how to avoid the duplicated of headers and footers when calling customer_new_account()? Or any other approach that could help me in achieving the same?

    Thank you.

    • This topic was modified 6 years, 6 months ago by albans.

The topic ‘New Account email template when adding user via WP admin’ is closed to new replies.