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?
我在WP 4.5.3和悉尼模板上运行WooCommerce 2.6.2。 p>
在订单明细下的WooCommerce Checkout页面(已完成订单)中,我想将“免费送货”文本更改为其他内容,或删除此行。 p>
我也想要 从发送给客户的电子邮件中更改或删除此行。 p>
但是,我无法将此文本翻译成翻译 p>
我已将此内容添加到我的functions.php p> \ n
//将此添加到您的functions.php
add_filter('gettext','translate_reply');
add_filter('ngettext','translate_reply');
function translate_reply($ translated){
$ translated = str_ireplace('免费送货','待定',$翻译);
return $翻译;
}
code> pre>
但它没有 工作。 也就是说,如果我改变'运输',那么它会翻译运输标签。 我不想翻译Label,我想翻译实际的送货方式名称。 p>
这真的令人沮丧。 改变一段文字应该不难。 p>
我如何实现这一目标? p>
div>
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:
- 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.
- 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.
Reference: WooCommerce rename "Free Shipping" field on checkout (old version until WC 2.5.x)
If it still does not change in the frontend, go to WooCommerce > Status > tools and clear WC transients!