如何从woocommerce电子邮件中删除帐单详细信息?
答
你也许可以做到这一点通过过滤woocommerce_email_customer_details_fields
:
function so_43549371_remove_billing_fields_from_emails($fields, $sent_to_admin, $order) {
error_log(json_encode($fields));
if(isset($fields['billing_email'])){
unset($fields['billing_email']);
}
return $fields;
}
add_filter('woocommerce_email_customer_details_fields', 'so_43549371_remove_billing_fields_from_emails', 10, 3);
这只会从所有电子邮件删除结算电子邮件,但是我通过额外的$sent_to_admin
和$order
参数,如果你只想做在一定条件下。
这将完全删除所有客户的详细信息:
function so_43549371_remove_customer_details() {
$mailer = WC()->mailer();
remove_action('woocommerce_email_customer_details', array($mailer, 'customer_details'), 10, 3);
}
add_action('woocommerce_email_header', 'so_43549371_remove_customer_details');
+0
谢谢,但这不起作用.. –
+0
您说得对,这不会看起来什么都不做,因为我在'$ fields'数组中的数组键上发生了错误。你能详细说明你想删除哪些字段吗? – helgatheviking
请**澄清你的具体问题或添加额外的细节,突显正是你需要的**。正如目前所写,很难确切地说出你在问什么。请参阅[如何问](http://stackoverflow.com/help/how-to-ask)页面以帮助澄清此问题 –