【发布时间】:2017-12-06 17:20:40
【问题描述】:
我正在尝试根据付款方式和运输方式的组合向 woocommerce 完成的订单电子邮件通知添加不同的内容。
到目前为止我的代码:
// completed order email instructions
function my_completed_order_email_instructions( $order, $sent_to_admin, $plain_text, $email ) {
if (( get_post_meta($order->id, '_payment_method', true) == 'cod' ) && ( get_post_meta($order->id, '_shipping_method', true) == 'local pickup' )){
echo "something1";
}
elseif (( get_post_meta($order->id, '_payment_method', true) == 'bacs' ) && ( get_post_meta($order->id, '_shipping_method', true) == 'local pickup' )){
echo "something2";
}
else {
echo "something3";
}}
付款部分有效(我得到了正确的“something1”到“something3”内容)但如果我添加&&运输条件,我会在每种付款方式中得到“something3”。
知道什么是错的,我怎样才能让它工作?
谢谢
【问题讨论】:
标签: php wordpress woocommerce orders email-notifications