簡體   English   中英

如何在 WooCommerce 中的已完成訂單 email 模板中添加新帳戶信息

[英]How to add new account info on order completed email template in WooCommerce

我正在嘗試減少我的 WooCommerce 網站之一上每個訂單發送的電子郵件數量。

現在,客戶會收到電子郵件

  • 創建新帳戶(除非他們以前有一個)
  • 收到訂單
  • 暫停訂單
  • 訂單完成。

我已經核對了待定訂單和收到的電子郵件,所以我從四個變成了兩個。


我想在 Order Completed email 上顯示帳戶登錄信息,因此我也可以消除發送 Account Created email,但是當我剛剛將代碼從customer-new-account.php email 模板復制到customer-completed-order.php email,列出用戶名和密碼的占位符都變成空白,這很奇怪。

這是我粘貼到子主題的 WooCommerce 文件夾中的代碼:

<?php /* translators: %s Customer username */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ); ?></p>
<?php /* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */ ?>
<p><?php printf( __( 'Thanks for creating an account on %1$s. Your username is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', make_clickable( esc_url( wc_get_page_permalink( 'myaccount' ) ) ) ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>

<?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?>
    <?php /* translators: %s Auto generated password */ ?>
    <p><?php printf( esc_html__( 'Your password has been automatically generated: %s', 'woocommerce' ), '<strong>' . esc_html( $user_pass ) . '</strong>' ); ?></p>
<?php endif; ?>

問題是在單擊“確認訂單”按鈕后會立即創建一個新帳戶。 向用戶發送“您的帳戶已創建”以及用戶名和密碼,密碼以加密形式寫入數據庫。

“已完成訂單”消息將在很晚的時候發送。 這封信不能再從數據庫中獲取密碼,因為它是加密的。 因此,在第二個字母的模板中插入帶有密碼的變量是沒有用的。

這是某種愚蠢的美國制度。 實際上,您必須向用戶發送 2 封信,他很容易在信中感到困惑,然后我們資源管理員將收到索賠,或者我們會堅持不懈地向客戶解釋如何進入該帳戶。

如果是正常的人類系統,在完成訂單的那一刻,就會創建一個新賬戶(好吧,這是合乎邏輯的。支付的人為他創建了一個賬戶),而當一個賬戶被提前創建時,在過渡到付款的階段。 這是開發人員創建的系統,一個人只需將卡號輸入支付系統? 他有一封這樣的信——“這是你的用戶名密碼!進來吧!” 哪里來的!? 你還沒有付款!

我正在嘗試減少在我的 WooCommerce 站點之一上每個訂單發送的電子郵件數量。

現在,客戶收到電子郵件

  • 創建了新帳戶(除非他們以前有一個)
  • 收到訂單
  • 訂單暫停
  • 訂單完成。

我已經檢查了暫停訂單和收到的電子郵件,所以這需要我從四個到兩個。


I want to display the account login info on the Order Completed email, so I can eliminate sending the Account Created email as well, but when I just copied over the code from the customer-new-account.php email template into the customer-completed-order.php email,同時列出用戶名和密碼的占位符變為空白,這很奇怪。

這是我粘貼到我的子主題的 WooCommerce 文件夾中的代碼:

<?php /* translators: %s Customer username */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ); ?></p>
<?php /* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */ ?>
<p><?php printf( __( 'Thanks for creating an account on %1$s. Your username is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', make_clickable( esc_url( wc_get_page_permalink( 'myaccount' ) ) ) ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>

<?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?>
    <?php /* translators: %s Auto generated password */ ?>
    <p><?php printf( esc_html__( 'Your password has been automatically generated: %s', 'woocommerce' ), '<strong>' . esc_html( $user_pass ) . '</strong>' ); ?></p>
<?php endif; ?>

暫無
暫無

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

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