【发布时间】:2018-03-13 12:39:49
【问题描述】:
目前,在我的 wordpress + woocommerce 系统中,为客户提供免费产品。
客户经常购买这些免费产品,woocommerce 会向管理员发送电子邮件以管理他们购买免费产品的每个订单。
当客户仅购买免费产品(总金额 = 0)时,我试图找到阻止 woocommerce 向管理员发送电子邮件的方法。
但我找不到路。
【问题讨论】:
标签: wordpress woocommerce
目前,在我的 wordpress + woocommerce 系统中,为客户提供免费产品。
客户经常购买这些免费产品,woocommerce 会向管理员发送电子邮件以管理他们购买免费产品的每个订单。
当客户仅购买免费产品(总金额 = 0)时,我试图找到阻止 woocommerce 向管理员发送电子邮件的方法。
但我找不到路。
【问题讨论】:
标签: wordpress woocommerce
如果总订单金额为 0.00,这应该会停止向管理员发送 新订单 电子邮件。你可以把它放在你的主题的functions.php中:
add_filter('woocommerce_email_enabled_new_order', function($enabled, $order) {
if ($order instanceof WC_Order) {
$order_total = floatval($order->get_total());
if ($order_total == 0) {
return false;
}
}
return $enabled;
}, 10, 2);
【讨论】: