php - 如何在新订单 WooCommerce 电子邮件通知中将 "Product"更改为 "Service"

标签 php wordpress templates woocommerce email-notifications

我的请求听起来很简单,但我无法配置它。我想将客户收到的新订单电子邮件中的“产品”一词更改为“服务”。因为我们提供的是服务,而不是产品。

我下载了一个名为“Say What?”的插件但我应该得到确切的文本域,但我没有找到。

我也尝试应用以下过滤器,但它也不起作用

add_filter( 'admin-new-order', '__return_false' );
 
function my_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'PRODUCT' :
            $translated_text = __( 'SERVICE', 'woocommerce' );
            break;
    }
    return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );

enter image description here

最佳答案

看看emails/email-order-details.php模板文件,行 42

  • 可以通过将其复制到 yourtheme/woocommerce/emails/email-order-details.php 来覆盖此模板。

替换

<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>

<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Service', 'woocommerce' ); ?></th>

关于php - 如何在新订单 WooCommerce 电子邮件通知中将 "Product"更改为 "Service",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63544115/

相关文章:

php - mysql插入查询自动递增值

php - 如何计算从数据库检索到的逗号分隔值

html - 字体不会在第一页加载时加载

C++ vector 作为类成员与函数中的比较

javascript - Handlebars.js 自定义条件帮助器

php - 如何安装 Yiistrap?我得到 CException Property "CUrlManager.bootstrap"is not defined

php - 用户收入不会更高

php - 从 WooCommerce 中的当前产品类别获取同级术语 ID 列表

wordpress - 导致 SSL CA 证书错误的主题

c++ - 类型删除和访问器