为了账号安全,请及时绑定邮箱和手机立即绑定

Woocommerce - 更改 2 结帐标签文本不起作用

Woocommerce - 更改 2 结帐标签文本不起作用

PHP
素胚勾勒不出你 2021-10-08 21:22:17
在 Woocommerce 的结帐页面中,我尝试更改“帐单详细信息”和“运送到其他地址?”的标签。到其他文本中,但是当我输入如下 2 个类似的代码时,它只更改一次:“帐单详细信息”确实更改为“您的帐单信息”,但“运送到不同地址”却没有。请帮忙。//Change the Billing Address checkout labelfunction wc_billing_field_strings( $translated_text, $text, $domain ) {    switch ( $translated_text ) {        case 'Billing details' :            $translated_text = __( 'Your billing info', 'woocommerce' );            break;    }    return $translated_text;}add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );function shipchange( $translated_text, $text, $domain ) {    switch ( $translated_text ) {        case 'Ship to a different address?' :            $translated_text = __( 'other shipping address?', 'woocommerce' );            break;    }    return $translated_text;}关于如何更改购物车和结帐页面 Woocommerce 中所有标签文本的任何方法?
查看完整描述

1 回答

?
哈士奇WWW

TA贡献1799条经验 获得超6个赞

试试这个代码。


function wc_billing_field_strings( $translated_text, $text, $domain ) {

    switch ( $translated_text ) {

        case 'Billing details' :

            $translated_text = __( 'Your billing info', 'woocommerce' );

            break;

        case 'Ship to a different address?' :

            $translated_text = __( 'other shipping address?', 'woocommerce' );

            break;

    }

    return $translated_text;

}

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


查看完整回答
反对 回复 2021-10-08
  • 1 回答
  • 0 关注
  • 110 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信