[英]Change sender name to customer billing full name in WooCommerce email notifications
[英]Change the billing email for notifications to a custom shipping one in WooCommerce
我將結帳頁面更改為更簡單的流程-我刪除了所有結算字段並改為使用送貨字段。 因此,我有shipping_email而不是billing_email 。
客戶下訂單時,他未收到電子郵件通知,因為未設置billing_email 。
您能否建議如何更改要發送到shipping_email的客戶通知。
您可以嘗試使用以下自定義掛鈎函數,在該函數中,我從您的自定義送貨電子郵件中設置了帳單電子郵件。 這樣,通知將發送到正確的電子郵件。
您應該檢查
'_shipping_email'
是否是“發運電子郵件自定義結帳”字段的正確元鍵…如果沒有用正確的替換它。
編碼:
add_action('woocommerce_checkout_update_order_meta', 'set_billing_email_from_shipping_email', 50, 2 );
function set_billing_email_from_shipping_email( $order_id, $data ) {
// Get customer shipping email
$email = get_post_meta( $order_id, '_shipping_email', true );
// Set billing email from shipping email
update_post_meta( $order_id, '_billing_email', $email );
}
代碼進入您的活動子主題(或活動主題)的function.php文件中。
經過測試和工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.