从woocommerce电子邮件中删除运费和帐单
问题描述:
我想从admin-new-order.php中删除帐单地址和送货地址。我的主题已经有了它的重复。我能够删除电子邮件和电话号码,但我不能删除帐单和运费。从woocommerce电子邮件中删除运费和帐单
要删除的电子邮件和电话我这样做是
add_filter('woocommerce_email_customer_details_fields', 'custom_woocommerce_email_customer_details_fields');
function custom_woocommerce_email_customer_details_fields($totals) {
unset(
$totals['billing_email'],
$totals['billing_phone']
);
return $totals;
}
我知道,如果我完全去除:
do_action('woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email);
它会删除一切,但我不能这样做,因为我需要注释和交付时间(从插件)显示在那里。如果我删除了整个东西,那么它会删除所有内容。
我已经试过
unset($totals['billing_first_name']);
和这个这么多的变化,但它不工作。
答
在你有以下的所有电子邮件模板做动作钩。 WC_Emails::email_address()
此功能码用于在邮件中添加帐单和运送详情。
/**
* @hooked WC_Emails::customer_details() Shows customer details
* @hooked WC_Emails::email_address() Shows email address
*/
do_action('woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email);
对于删除邮件把波纹管功能付款和发货的细节在你的function.php
文件
function removing_customer_details_in_emails($order, $sent_to_admin, $plain_text, $email){
$wmail = WC()->mailer();
remove_action('woocommerce_email_customer_details', array($wmail, 'email_addresses'), 20, 3);
}
add_action('woocommerce_email_customer_details', 'removing_customer_details_in_emails', 5, 4);
请张贴在动作的所有变量的var_dump()。 – DrDamnit
它的帖子太长了。它只允许在这里有600个字符:/ – Franky
使用https://giat.github.com或paatebin.com – DrDamnit