如何获得WooCommerce电子邮件收件人?

时间:2015-07-31 18:45:53

标签: wordpress email woocommerce

如何在此代码中获取$ wc_recipient var的woocommerce电子邮件的收件人?

function profit_extra_email( $headers ){

  if(  get_option('admin_email') == $wc_recipient  ){

    $headers .= 'BCC: bcc@email.com>' . '\r\n';

  }

  return $headers;

}
add_action( 'woocommerce_email_headers', 'profit_extra_email', 10, 3 );

2 个答案:

答案 0 :(得分:0)

试试这个

function profit_extra_email( $headers, $recipient ){
if(  get_option('admin_email') == $recipient  ){
$headers .= 'BCC: bcc@email.com>' . '\r\n';
}

return $headers;
}
add_action( 'woocommerce_email_headers', 'profit_extra_email', 10, 2 );

美元收件人可用于woocommerce功能,我没有尝试但它应该工作

答案 1 :(得分:0)

为什么不使用wp_mail过滤器? 将其添加到您的functions.php

function my_wp_mail_filter( $mail ) {
    if( $mail['to'] == get_option('admin_email') )
        $mail['headers'] .= 'BCC: bcc@email.com>' . '\r\n';

    return $mail;
}
add_filter( 'wp_mail', 'my_wp_mail_filter' );