为了账号安全,请及时绑定邮箱和手机立即绑定

将产品名称添加到WooCommerce中的电子邮件主题

将产品名称添加到WooCommerce中的电子邮件主题

PHP
慕斯709654 2021-04-01 16:11:49
如何在此电子邮件的主题行中添加产品名称。是否有电子邮件主题行可用过滤器的列表?我希望能够做到这一点而不必编写自定义php。我正在寻找做这样的事情:已完成的订单-[{{product_name}]({order_number})-{order_date}尝试并添加了以下代码,functions.php但未显示主题:add_filter( 'woocommerce_email_subject_customer_completed_order', 'customer_completed_order_subject', 10, 2 ); function customer_completed_order_subject($string,$order){$fname = $order->billing_first_name;$lanme = $order->billing_last_name;$email = $order->billing_email;$items = $order->get_items();foreach($items as $meta_key => $items){    $product_name = $items['name'];    $product_id = $items['product_id'];}$subject_line = get_field('email_subject',$product_id);$subject_line = str_replace('{product}',$product_name,$subject_line);$subject_line = str_replace('{biller_fname}',$fname,$subject_line);$subject_line = str_replace('{biller_lastname}',$lanme,$subject_line);$subject_line = str_replace('{biller_email}',$email,$subject_line);$subject_line = str_replace('{blog_name}',get_bloginfo('name'),$subject_line);return $subject_line;}
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 136 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信