duanganleng0577 2016-07-10 20:14
浏览 60
已采纳

WooCommerce免费送货 - 删除原始或更改结帐和电子邮件中的文本名称

I am running WooCommerce 2.6.2 on WP 4.5.3 and Sydney template.

On the WooCommerce Checkout Page (Order completed) under Order Details, I want to Change the 'Free Shipping' text to something else, or remove this row.

I ALSO want to change or remove this row from the Emails sent to the Customer.

However, I can't get this text to Translate

I've added this to my functions.php

// Add this to your functions.php
add_filter('gettext', 'translate_reply');
add_filter('ngettext', 'translate_reply');

function translate_reply($translated) {
$translated = str_ireplace('Free Shipping', 'TBD', $translated);
return $translated;
}

But it doesn't work. That said, if I change just 'Shipping' then it translates the shipping label. I don't want to translate the Label, I want to translate the actual shipping method name.

This is REALLY getting frustrating. It shouldn't be this difficult to change a piece of text.

How can I achieve this?

  • 写回答

2条回答 默认 最新

  • dtqf81594 2016-07-10 22:31
    关注

    Normally you don't need any code for this. As there is big changes Since WooCommerce 2.6+ for Shipping settings options, I have divided my answer in 2 sections:

    1. In WC version 2.5 and before (old way):

    In Admin backend go to: WooCommerce > settings > Shipping > Free shipping

    You can:

    • Disable free shipping, to remove the row as you asked.
    • Rename "Free Shipping" by something else's you asked too.

    Free shipping settings for WC 2.5

    1. In WC version 2.6+ (It's different):

    In Admin backend go to: WooCommerce > settings > Shipping > Shipping Zones

    Then For each Shipping Zone listed you can have (or not) Free Shipping Shipping method enabled. So for each Shipping Zone listed, you can:

    • Remove Free Shipping (by Shipping Zone), to remove the row as you asked.
    • Rename "Free Shipping" (by Shipping Zone) by something else's you asked too.

    Free shipping settings for WC 2.6+ (1)

    Free shipping settings for WC 2.6+ (2)

    Free shipping settings for WC 2.6+ (3)

    Reference: WooCommerce rename "Free Shipping" field on checkout (old version until WC 2.5.x)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 用verilog实现tanh函数和softplus函数
  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 51寻迹小车定点寻迹
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站
  • ¥15 滑块验证码移动速度不一致问题