Reputation: 129
I'm trying to override the Woocommerce template structure in the following way: http://docs.woothemes.com/document/template-structure/.
The file I'm trying to override is: your_template_directory/woocommerce/emails/customer-new-account.php.
At the end of this file I added the following 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');
This code is to send an e-mail to the admin of the website. The admin_email is retrieved by the get_bloginfo
function. However, I'm trying to send the e-mail to the store manager instead. Any idea what function or code should be used in this case?
Another option could be to add the following code to the functions.php file and adapt this so it sends a notification to the store manager instead of the admin:
/**
* Notify admin when a new customer account is created
*/
add_action( 'woocommerce_created_customer', 'woocommerce_created_customer_admin_notification' );
function woocommerce_created_customer_admin_notification( $customer_id ) {
wp_send_new_user_notifications( $customer_id, 'admin' );
}
Upvotes: 0
Views: 344
Reputation: 129
Solved this as follows. I've added the following code in my functions.php
file:
/* SEND NEW CUSTOMER EMAIL TO KILIKILI */
/* --- */
add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
function mycustom_headers_filter_function( $headers, $object ) {
if ($object == 'customer_new_account') {
$headers .= 'BCC: Store manager name <[email protected]>' . "\r\n";
}
return $headers;
}
Upvotes: 1