首页 文章

如何在Woocommerce模板中检测电子邮件收件人?

提问于
浏览
0

我是'm trying to customize email templates in woocommerce so the customer gets the normal email notification with his new order data with some little customization, and the admin gets the new order email notification with some more detailed data of the order. Woocommerce provides several email templates and hooks to customize this, and in fact, there'是一个名为 admin-new-order.phpcustomer-processing-order.php 的模板,但是那里有's something particular that doesn' t,它是 email-order-items.php 文件,因为这对两个模板都是通用的(如"partial") .

此文件提取包含名称,数量和价格列的订单商品,并将其打印在电子邮件模板中 . 我设法在这些列单元格中包含一些信息,但是如果收件人是客户或是管理员,我需要决定是否包含某些信息,如何查询此订单商品(产品)表的父模板的收件人?

非常感谢

1 回答

  • 0

    我以一种非常漂亮的方式解决了它,因为有两个模板文件( admin-new-order.phpcustomer-processing-order.php )调用一个使用模板子函数( email-order-items.php )的函数,我需要知道"caller"模板是否适用于客户的管理员 . 我在调用打印products表的函数之前设置了一个全局变量,在该表中我有条件地放了一些信息 .

    如果有更好,更清洁的方式,我正在倾听......

相关问题