最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Custom sender email address for specific WooCommerce product

programmeradmin2浏览0评论

I have a WooCommerce shop and it sends emails on every product order submission. I need to change the sender email address just for specific products into a custom address.

Already I am trying to achieve this using this code snippet to no avail:

add_filter('wp_mail_from', 'new_mail_from');

function new_mail_from($old) {
    return '[email protected]';
}

I have a WooCommerce shop and it sends emails on every product order submission. I need to change the sender email address just for specific products into a custom address.

Already I am trying to achieve this using this code snippet to no avail:

add_filter('wp_mail_from', 'new_mail_from');

function new_mail_from($old) {
    return '[email protected]';
}
Share Improve this question edited Mar 27, 2020 at 20:52 WordPress Speed 2,2833 gold badges19 silver badges34 bronze badges asked Mar 27, 2020 at 8:32 ELEELE 134 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

You have to use this filter:

add_filter( 'woocommerce_email_recipient_new_order', function( $recipient, $object ){
  if($conditional){
    $recipient = '[email protected]';
  }
  return $recipient;
});
发布评论

评论列表(0)

  1. 暂无评论