In WordPress, administrators typically receive email notifications whenever a new user registers on the website. However, this built-in functionality doesn’t extend to WooCommerce, the popular e-commerce platform for WordPress. This lack of notification for new customer registrations in WooCommerce can lead to missed opportunities for engaging with customers and managing user accounts effectively.

The Need for Email Notifications in WooCommerce

As an administrator of a WooCommerce store, staying informed about new customer registrations is crucial for managing user accounts, providing personalized customer support, and monitoring the growth of your online business. Email notifications for new customer registrations ensure that administrators are promptly notified whenever a new user signs up on the website, allowing them to take timely actions such as verifying account details, welcoming new customers, or managing user roles.

Solution: Email Notifications for New Customer Registrations

To address the issue of missing email notifications for new customer registrations in WooCommerce, we propose a simple solution using a code snippet. This snippet triggers an email notification to the site administrator whenever a new customer registers on the WooCommerce store.

add_action( 'woocommerce_created_customer', 'woo_new_user_to_admin_notification', 100, 3 );

/**
 * Send email notification to Admin on new customer registration.
 *
 * @param int     $customer_id
 * @param array   $new_customer_data
 * @param boolean $is_password_generated
 * @return void
 */
function woo_new_user_to_admin_notification( $customer_id, $new_customer_data, $is_password_generated ) {
    wp_new_user_notification( $customer_id, null, 'admin' );
}

How to Use the Snippet Code

You can implement this snippet by following on of these steps:

  1. Child Theme: If you’re using a custom child theme, you can add the snippet to the functions.php file of your child theme. This ensures that the functionality remains intact even when you update your theme.
  2. Custom Plugin: A better way, you can create a custom plugin to add the snippet. Creating a custom plugin allows you to keep your code separate from the theme files, making it easier to manage and maintain. You can use our online tool WP Plugin Creator to generate a custom plugin with the snippet included. Simply paste the snippet into the plugin code editor, specify the plugin name, and download the generated plugin zip file.