如何使用电子邮件类型”纯文本”在管理电子邮件中添加购买记录?电子商务

在线订购时, 你可以在此部分向管理员输入有关某些事项的采购单或订单单。使用电子邮件类型HTML时可以显示此注释, 但是使用纯文本时, 该注释不会显示在管理员通知电子邮件中。如何实现它才能显示出来?

谢谢


#1


woocommerce / templates / emails / plain / admin-new-order.php中有一个钩子

do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );

你可以将一段代码添加到你的functions.php中, 并将其挂钩到” woocommerce_email_order_meta”, 后者将从订单中获取注释并显示出来。 https://docs.woocommerce.com/document/introduction-to-hooks-actions-and-filters/

尝试这样的事情:

add_action('woocommerce_email_order_meta', 'add_note_to_admin_new_order_plain', 20, 4);
function add_note_to_admin_new_order_plain($order, $sent_to_admin, $plain_text, $email)
{
    if (!$sent_to_admin || !$plain_text) {
        return;
    }
    if ($order->get_customer_note()) {
        echo 'Customer note : ' . $order->get_customer_note();
    }
}

但是, 在测试时, 我注意到默认的woocommerce主题默认情况下会显示注释, 因此你应该检查功能或主题中的某个地方是否未取消钩子或已删除, 该功能无法帮助你进行自定义可以在任何地方完成

来源:

https://www.srcmini02.com/65235.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37317.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?