首页 文章

Woocommerce新客户管理通知电子邮件

提问于
浏览
5

我正在使用Wordpress和Woocommerce Build 一个电子商务网站 . 我需要该网站在注册新客户帐户时向网站管理员发送通知电子邮件 . 我认为这个功能将内置到Woocommerce中,因为它使用Wordpress用户帐户结构而Wordpress发送新的用户通知,但它似乎不是 . 有没有人知道我可以用来添加此功能的插件或功能?谢谢!

4 回答

  • 1
    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 是当用户通过woocommerce创建时调用的钩子 . 它只向客户发送通知 . 我们将使用wp_new_user_notification()函数向Admin发送通知 .

  • 3

    我假设你在电子邮件中使用html . 如果您使用纯文本,则过程类似 .

    您需要覆盖woocommerce模板结构 . 在这里您可以找到:http://docs.woothemes.com/document/template-structure/ .

    实际上,您需要覆盖的唯一文件是your_template_directory / woocommerce / emails / customer-new-account.php .

    在此文件的末尾添加以下代码行:

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

    在functions.php中添加:

    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');
    
  • 6

    我正在试图解决同样的问题,并且在与开发人员来回之后,默认是 not 向管理员发送新的客户注册通知电子邮件 .

    尝试各种电子邮件插件,甚至使用WP SMTP电子邮件后,我终于决定不管它 .

    也就是说,WooCommerce 2.0今天发布,因此它可以在新版本中构建 .

  • 1

    答案在“ woocommerce / settings ”的电子邮件部分

    只需将电子邮件更改为 wordpress@yourdomain.com

    为我工作,因为我也有同样的问题

相关问题