【发布时间】:2019-02-03 18:53:24
【问题描述】:
我正在尝试使用 Woocommerce 挂钩来更改特定的电子邮件模板。我想在我的functions.php 文件中覆盖customer-processing-order.php 和customer-completed-order.php 中的文本。这是我正在使用的代码:
add_action( 'woocommerce_email_customer_details', 'hitt_processing_customer_email', 10, 4 );
function hitt_processing_customer_email( $order, $sent_to_admin, $plain_text, $email ) {
if( 'customer_processing_order' == $email->id ){
echo '<p>My custom content here</p>';
}
if( 'customer_completed_order' == $email->id ){
echo '<p>My custom content here</p>';
}
}
但这似乎不起作用。我将自己设置为客户,当我收到 “您的订单正在处理中” 电子邮件时,它没有添加自定义文本。我做错了什么?
【问题讨论】:
-
您不能使用挂钩来更改从电子邮件开始的文本,因为它在相关模板本身中是硬编码的......因此您需要通过您的活动主题覆盖两个相关模板as explained in this official documentation
标签: php wordpress woocommerce orders email-notifications