duanjianl183188 2016-04-14 10:02
浏览 66
已采纳

无法更改woocommerce中的“Postcode / ZIP”字段标签

I have a site in hebrew based on woocommerce. The translation is work great, however, the field "Postcode / ZIP" is refuse to be trasnlate:

enter image description here

I've tried to change it using this code:

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {

    $fields['billing']['billing_postcode']['label'] = 'test';

    return $fields;
}

But something weird happen: when I reload the page I can see the change take effect, but after a second it change back to "Postcode / ZIP". Another weird thing: the above script work for the other fields, something is wrong with that specific field.

Anyone know what's going on?

Thanks!

  • 写回答

1条回答 默认 最新

  • douzhuiqing1151 2016-04-16 16:45
    关注
    function my_text_strings( $translated_text, $text, $domain ) {
        switch ( $translated_text ) {
            case 'Postcode / ZIP' :
                $translated_text = __( 'test', 'woocommerce' );
                break;
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'my_text_strings', 20, 3 );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 hexo+github部署博客
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?