如果用户账户里有0元的账单,那么每个月都会收到收款确认,有些奇怪,那么如何删除?
简短的答案是我们不能禁用。
前一段时间,我一直在寻找解决方案,不要发送总额为0.00的发票(或者甚至可能产生)。
对于客户看到有关他们的0.00美元发票的付款确认有点奇怪。他们是有点“免费”的发票,他们立即被标记为付款。
到目前为止,我没有找到任何解决方案,并在官方论坛上发现了很多类似的请求。
所以这里有一个钩子来禁用这些发票的电子邮件发送:
function disable_00_invoices($vars) {
$email_template_name = $vars['messagename']; # Email template name being sent
$relid = $vars['relid']; # Related ID it's being sent for - client ID, invoice ID, etc...
//Checking for certain template name, if so - this is our case
if ($email_template_name == "Invoice Created" || $email_template_name == "Invoice Payment Confirmation")
{
//getting total of the invoice
$result = select_query('tblinvoices', 'total', array("id" => $relid));
$data = mysql_fetch_assoc($result);
//if it is equal to '0.00' we disable email sending
if (isset($data['total']) && $data['total'] == '0.00')
$merge_fields['abortsend'] = true;
}
return $merge_fields;
}
add_hook("EmailPreSend",1,"disable_00_invoices");