WordPress教程:WooCommerce更改电子邮件主题行

更改电子邮件主题行

/*
 * Subject filters: 
 *   woocommerce_email_subject_new_order
 *   woocommerce_email_subject_customer_procesing_order
 *   woocommerce_email_subject_customer_completed_order
 *   woocommerce_email_subject_customer_invoice
 *   woocommerce_email_subject_customer_note
 *   woocommerce_email_subject_low_stock
 *   woocommerce_email_subject_no_stock
 *   woocommerce_email_subject_backorder
 *   woocommerce_email_subject_customer_new_account
 *   woocommerce_email_subject_customer_invoice_paid
 **/
add_filter('woocommerce_email_subject_new_order', 'change_admin_email_subject', 1, 2);
 
function change_admin_email_subject( $subject, $order ) {
  global $woocommerce;
 
  $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
 
  $subject = sprintf( '[%s] New Customer Order (# %s) from Name %s %s', $blogname, $order->id, $order->billing_first_name, $order->billing_last_name );
 
  return $subject;
}

在哪里添加此代码?

将PHP代码放在主题或子主题functions.php文件的底部。

小朱博客

View posts by 小朱博客
小朱个人博客,生活网络分享,外贸建站,谷歌seo操作分享,B2B优化排名操作分享,资源分享,软件分享,生活分享。https://www.zhudc.com/

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

Scroll to top