dragonlew9876 2018-11-05 15:34
浏览 183
已采纳

在woocommerce管理设置面板中重命名电子邮件通知标题

A simple question: How can I rename the WooCommerce email template names under WooCommerce -> E-Mails?

enter image description here

For example:

Old: Neue Bestellung New: New Title

  • 写回答

1条回答 默认 最新

  • dongtaigan1594 2018-11-05 16:58
    关注

    To rename Email notification titles, you will use the following (replacing them by yours):

    add_filter( 'woocommerce_email_title', 'change_woocommerce_email_title', 10, 2 );
    function change_woocommerce_email_title( $email_title, $email ){
    
        // Only on backend Woocommerce Settings "Emails" tab
        if( isset($_GET['page']) && $_GET['page'] == 'wc-settings' && isset($_GET['tab'])  && $_GET['tab'] == 'email' ) {
    
            $domain = "woocommerce"; // The text domain
    
            switch ($email->id) {
    
                case 'new_order':
                    $email_title = __("New Order Email", $domain);
                    break;
    
                case 'cancelled_order':
                    $email_title = __("Cancelled Order Email", $domain);
                    break;
    
                case 'failed_order':
                    $email_title = __("Failed Order", $domain);
                    break;
    
                case 'customer_on_hold_order':
                    $email_title = __("Customer On Hold Order Email", $domain);
                    break;
    
                case 'customer_processing_order':
                    $email_title = __("Customer Processing Order Email", $domain);
                    break;
    
                case 'customer_completed_order':
                    $email_title = __("Customer Completed Order Email", $domain);
                    break;
    
                case 'customer_refunded_order':
                    $email_title = __("Customer Refunded Email", $domain);
                    break;
    
                case 'customer_invoice':
                    $email_title = __("Customer Invoice Email", $domain);
                    break;
    
                case 'customer_note':
                    $email_title = __("Customer note Email", $domain);
                    break;
    
                case 'customer_reset_password':
                    $email_title = __("Customer Reset Password Email", $domain);
                    break;
    
                case 'customer_new_account':
                    $email_title = __("Customer New Account Email", $domain);
                    break;
            }
        }
    
        return $email_title;
    }
    

    Code goes in function.php file of your active child theme (active theme). Tested and works.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?