我想从Woocoommerce的电子邮件中删除结算明细,除了编辑所有电子邮件模板之外还有其他方法吗?
答案 0 :(得分:0)
您可以通过过滤woocommerce_email_customer_details_fields
:
function so_43549371_remove_billing_fields_from_emails( $fields, $sent_to_admin, $order ) {
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' );