更改“帐单明细"文本发送到“运费明细"在WooCommerce结帐页面上 [英] Change "Billing Details" text to "Shipping Details" on WooCommerce checkout page

查看:89
本文介绍了更改“帐单明细"文本发送到“运费明细"在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天全站免登陆