Sarathlal N

Send notification to administrator on WooCommerce user registration

In WordPress sites, if a new user was registered, the WordPress will send a notification to administrator. But if we are using WooCommerce, user registration will done through process_registration action in WooCommerce. At that time, WordPress never send email notification to admin about new user.

So now we are going to override this functionality by adding a little code snippet to our theme’s / child theme’s functions.php file.

add_action('woocommerce_created_customer', 'admin_email_on_registration', 10 , 1);
function admin_email_on_registration( $customer_id) {
	wp_new_user_notification( $customer_id );
}

The woocommerce_created_customer is a hook which is called during new user registration by WooCommerce. In default, it only sends notification to customers. So we just call the WordPress default new user notification function - wp_new_user_notification() on WooCommerce user registration process to send notification to administrator.

Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!

Recent Posts

  1. Automating Code Linting with GitHub Actions for WordPress Plugins
  2. Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
  3. The Ultimate Guide to Indexing in Database Design
  4. Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
  5. A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about it, please get in touch.