【发布时间】:2016-02-01 01:37:46
【问题描述】:
我之前问过这个问题,但不幸的是我意识到给出的答案不起作用,所以我再次问:
I am trying to add some text to the customer-order-processing email from WooCommerce, and it should ONLY be added in this particular email and ONLY if chosen payment method is Paypal.我已经到目前为止,只有添加文本,只有在PayPal被选为付款方式时,只有在付款方式中,文本将在每封电子邮件中显示到客户端,例如订单完成的电子邮件或客户 - 笔记电子邮件。我有以下内容:
add_action('woocommerce_email_before_order_table','add_order_email_instructions', 0, 2);
function add_order_email_instructions( $order, $sent_to_admin ) {
if ( 'paypal' == $order->payment_method && ! $sent_to_admin ) {
echo 'my text:';
}
}
我尝试过使用其他条件,例如 ! $order->has_status( 'processing' ),但没有任何效果。有什么帮助吗?
【问题讨论】:
-
据我所知,没有办法知道您在使用哪个电子邮件 ID/类型。我觉得我以前看过这个,但是在尝试修补 WooCommerce 时遇到了麻烦。
-
我创建了一个pull request,将来可能会实现。如果不接受它们,则必须覆盖
customer-order-processing.php模板。 -
谢谢,希望能被采纳!
-
被合并了,所以在github的master分支里,但不知道什么时候正式发布。
标签: php wordpress woocommerce