更改“账单明细"文本到“运输详细信息"在 WooCommerce 结帐页面上 [英] Change "Billing Details" text to "Shipping Details" on WooCommerce checkout page

查看:32
本文介绍了更改“账单明细"文本到“运输详细信息"在 WooCommerce 结帐页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在我的子主题的 functions.php 文件中有一些代码,它应该在我的 WooCommerce 结帐页面上将账单详细信息"更改为发货详细信息".

I currently have a bit of code in my child theme's functions.php file which is supposed to change "Billing Details" to say "Shipping Details" on my WooCommerce checkout page.

但是,当我更新到 WooCommerce 3.0 时,代码片段停止工作.下面是我使用的代码.

However, when I updated to WooCommerce 3.0, the code snippet stopped working. Below is the code I was using.

function wc_billing_field_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Billing Details' :
            $translated_text = __( 'Shipping Details', 'woocommerce' );
            break;
    }
    return $translated_text;
}

add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );

我真的很想要一个适用于 WooCommerce 3.0 的代码片段.

I would really like a code snippet that works with WooCommerce 3.0.

推荐答案

function wc_billing_field_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Billing details' :
            $translated_text = __( 'Billing Info', 'woocommerce' );
            break;
    }
    return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );

使用 WooCommerce 3.0.6 测试正常

这篇关于更改“账单明细"文本到“运输详细信息"在 WooCommerce 结帐页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆