簡體   English   中英

在Woocommerce電子郵件通知中編輯客戶詳細信息

[英]Edit customer details in Woocommerce email notifications

WooCommerce在哪里包含來自第三方插件的自定義字段? 我想編輯顯示所有字段的順序。

在admin-new-order.php中,我可以通過在Woocommerce_email_customer_details上方放置Woocommerce_email_customer_details鈎子來執行此woocommerce_email_order_meta

只有我才能用我的客戶收到的電子郵件將其存檔?

根據此問題/答案中的數據,可以使用以下掛鈎函數來完成此操作,該函數可讓您編輯帳單格式的地址數據:

add_filter( 'woocommerce_order_formatted_billing_address', 'custom_email_formatted_billing_address', 10, 2 );
function custom_email_formatted_billing_address( $billing_address, $order ){
    // Get your custom field
    $real_first_name = get_post_meta( $order->get_id(), '_billing_voornaam_1_24', true );

    // Insert the custom field value in the billing first name
    if( ! empty( $real_first_name ) )
        $billing_address['first_name'] .= ' ' . $real_first_name;

    // Hiding Last name
    unset($billing_address['last_name']);

    return $billing_address;
}

代碼進入活動子主題(或活動主題)的function.php文件中。

經過測試和工作。

對於運送客戶的詳細信息,您將以相同的方式使用woocommerce_order_formatted_shipping_address篩選器掛鈎…

暫無
暫無

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

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