在WooCommerce新订单电子邮件通知的主题中添加产品名称
P粉990008428
P粉990008428 2023-08-18 08:55:45
0
1
521
<p>我想要修改发送给店主的电子邮件的主题行,将产品名称放入其中。 我看到了这段代码,可以将客户的名字放在前面 我该如何调整这段代码来包含产品名称</p> <pre class="brush:php;toolbar:false;">/* * 放在主题的functions.php或自定义插件中 * * 主题过滤器: * woocommerce_email_subject_new_order * woocommerce_email_subject_customer_processing_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] 新客户订单 (# %s) 来自姓名 %s %s', $blogname, $order-&gt;id, $order-&gt;billing_first_name, $order-&gt;billing_last_name ); return $subject; }</pre> <p>也许我们只需要在这里进行修改</p> <pre class="brush:php;toolbar:false;">$subject = sprintf( '[%s] 新客户订单 (# %s) 来自姓名 %s %s', $blogname, $item-&gt;get_name, $order-&gt;billing_first_name, $order-&gt;billing_last_name ); return $subject; }</pre> <p><br /></p>
P粉990008428
P粉990008428

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!