我是 Woocommerce 的新手,我试图在电子邮件的开头显示客户的姓名。
所以电子邮件看起来像这样:
[HEADER]您的订单已下达[/HEADER]
[H2]嗨{CUSTOMER_NAME}[/H2]
[P]一些文字[/P]
[邮件的其余部分]
我尝试在我的主题中将类似的内容添加到 functions.php 中。
//add the first name of the person to the email.
add_filter('woocommerce_email_order_details','name_to_processing_customer_email', 10, 3);
function name_to_processing_customer_email( $order, $sent_to_admin, $plain_text, $email ) {
if( 'customer_processing_order' == $email->id ){
// Set here as you want your custom content (for customers and email notification related to processing orders only)
echo '<h2>Hej '.$order->billing_first_name .'</h2>';
}
}
但这不起作用。有人可以帮忙吗?