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. Scaling WordPress - How Custom Database Tables Solve the Post Meta Bottleneck
  2. WordPress Transients Explained - A Developer's Guide to Site Performance
  3. Behind the Click - The Hidden Journey of Your Web Requests
  4. Automating Code Linting with GitHub Actions for WordPress Plugins
  5. Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer

Your Questions / Comments

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