如何从woocommerce电子邮件中删除结算明细?

时间:2017-04-21 18:09:05

标签: php wordpress woocommerce

我想从Woocoommerce的电子邮件中删除结算明细,除了编辑所有电子邮件模板之外还有其他方法吗?

1 个答案:

答案 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' );
相关问题