簡體   English   中英

從woocommerce電子郵件中刪除運輸和計費

[英]remove shipping and billing from woocommerce email

我想從admin-new-order.php中刪除帳單郵寄地址和收貨地址。 我的主題中已經有一個副本。 我能夠刪除電子郵件和電話號碼,但無法刪除賬單和運輸。

要刪除電子郵件和電話,我這樣做

    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 );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM