Change registration notice recipient

Friday, 08 May 2020

WooCommerce B2B, among its features, allow you to send email to admin on every new customer account registration, so when a customer create an account, an email is send to admin to inform him.
But in some cases, you may want the recipient of this notification be another email address instead of the administrator.

To do this, edit functions.php file that you find in your site’s FTP space in:

 wp-content/themes/{YOUR_ACTIVE_THEME}/functions.php

and insert this code:

add_filter( 'wp_new_user_notification_email_admin', function( $wp_new_user_notification_email_admin, $user, $blogname ) {
    $wp_new_user_notification_email_admin['to'] = 'example@domain.com';
    return $wp_new_user_notification_email_admin;
}, 10, 3 );
WARNING! Before making any changes, make sure you have made a complete backup of site files and database.
It is advisable not to edit the theme files directly, but to use a child theme.
For more information on child themes, please read: WordPress Official guide on Child Themes