Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Woocommerce New Customer Admin Notification Email

I am building an ecommerce site using Wordpress and Woocommerce. I need the site to send out a notification email to the site administrator when a new customer account is registered. I thought this functionality would be built into Woocommerce since it uses the Wordpress user account structure and Wordpress sends new user notifications, but it doesn't appear to be. Does anyone know of a plugin or a function I can use to add this functionality? Thanks!

like image 717
BWDesign Avatar asked Jan 15 '13 18:01

BWDesign


People also ask

How do I add email alerts to WooCommerce?

Go to WooCommerce → Settings → Emails The settings page lets you create WooCommerce conditional emails. Simply type in multiple email addresses to which you want to send a WooCommerce shipping notification.

Does WooCommerce send Emails to customers?

WooCommerce sends emails automatically when an order moves from one status to another. But if the emails aren't set up correctly, you and your customer might not receive them.

How do I change email notifications in WooCommerce?

Navigate to WooCommerce → Settings → Emails tab from the WordPress admin panel. Click on the Manage button next to the email you want to edit and enter the recipient address. You can also customize Email sender options to customize to sender information and the Email template.


4 Answers

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

woocommerce_created_customer is hook which is called when user created by woocommerce. It only sends notification to customer. we will use wp_new_user_notification() function to send notification to Admin.

like image 26
Makarand Mane Avatar answered Sep 19 '22 12:09

Makarand Mane


the answers is in the emails sections of "woocommerce / settings"

simply change the from email to [email protected]

worked for me as i also had the same issues

like image 45
Juzz Franks Avatar answered Sep 21 '22 12:09

Juzz Franks


I'm assuming that you are using html inside emails. If you are using plain text the procedure is similar.

You need to override the woocommerce template structure. Here you can find how: http://docs.woothemes.com/document/template-structure/.

Actually the only file you need to override is your_template_directory/woocommerce/emails/customer-new-account.php.

At the end of this file add this line of code:

<?php do_action( 'new_customer_registered', $user_login ); ?>

In functions.php add this:

function new_customer_registered_send_email_admin($user_login) {
  ob_start();
  do_action('woocommerce_email_header', 'New customer registered');
  $email_header = ob_get_clean();
  ob_start();
  do_action('woocommerce_email_footer');
  $email_footer = ob_get_clean();

  woocommerce_mail(
    get_bloginfo('admin_email'),
    get_bloginfo('name').' - New customer registered',
    $email_header.'<p>The user '.esc_html( $user_login ).' is registered to the website</p>'.$email_footer
  );
}
add_action('new_customer_registered', 'new_customer_registered_send_email_admin');
like image 180
danielevigi Avatar answered Sep 20 '22 12:09

danielevigi


I was pulling my hair out trying to figure this same issue out and after going back and forth with the developers the default is to not send new customer registration notification emails to admin.

After trying various email plugins and even resorting to using WP SMTP Email, I finally decided to leave it alone.

That said, WooCommerce 2.0 was released today so it may be built in the new version.

like image 27
joshuaiz Avatar answered Sep 19 '22 12:09

joshuaiz