Add VAT number in admin new user registration notification


Wednesday, 03 May 2023

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 to add also VAT number in email data.

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


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['message'] .= sprintf( __( 'VAT number: %s', 'woocommerce-b2b' ), get_user_meta( $user->ID, 'billing_vat', true ) );
    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