【问题标题】:Additional recipients on woocommerce invoicewoocommerce 发票上的其他收件人
【发布时间】:2016-09-01 04:14:39
【问题描述】:

有没有办法在 woocommerce 发票邮件中添加其他收件人。 我尝试使用 'woocommerce_email_headers' 挂钩,但它不起作用:

add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);

function mycustom_headers_filter_function($headers, $object) {
    $headers = array();
    $headers[] = 'Bcc: My Name <me@gmail.com>';
    $headers[] = 'Content-Type: text/html';
    return $headers;
}

有什么建议吗?

【问题讨论】:

    标签: woocommerce


    【解决方案1】:

    您也可以扩展该功能以包含订单:

    add_filter( 'woocommerce_email_headers', 'woo_cc_emails', 10, 3 );
    
    function woo_cc_emails( $headers, $status, $object ) {
        return 'Bcc: your@email.here' . "\r\n";
    }
    

    【讨论】:

    • 您能解释一下如何使用它在密件抄送字段中添加多个地址吗?
    • 以下应该可以工作:return 'Bcc: your@email.here, another@email.com, and@another.com' . "\r\n";
    【解决方案2】:

    几个月后,但我希望这会对某人有所帮助。

    add_filter('woocommerce_email_headers', 'woo_cc_emails');
    function woo_cc_emails() {
      return 'Bcc: your@email.here' . "\r\n";
    }
    

    您可以使用“收件人”或“抄送”更改“密件抄送”。

    【讨论】:

      【解决方案3】:

      我需要帮助才能将密件抄送添加到新客户帐户电子邮件。这是我想出的。与上面的略有不同。希望这可以帮助某人。

      add_filter( 'woocommerce_email_headers', 'add_bcc_to_wc_customer_new_account', 10, 3 );
      function add_bcc_to_wc_customer_new_account( $headers = '', $id = '', $wc_email = array() ) {
      if ( $id == 'customer_new_account' ) {
          $headers .= "Bcc: my_personal@email.com\r\n"; // replace my_personal@email.com with your email
      }
      return $headers;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-01-26
        • 1970-01-01
        • 1970-01-01
        • 2021-06-04
        • 2016-05-21
        • 1970-01-01
        • 2019-08-24
        相关资源
        最近更新 更多