在Woocommerce收到的订单页面中更改特定的订单详细信息文本
在收到订单的页面(' woocommerce_thankyou
')上,有一个表格,其中包含订单详细信息,标题为订单详细信息" ( Ordredetaljer
以我的母语).
On the order-recieved page ('woocommerce_thankyou
') there is a table with the order details a heading "Order Details" (Ordredetaljer
in my native language).
我不知道如何更改此标题.我什至找不到正确的源代码.如果有人可以告诉我字符串(我们使用wpml进行字符串翻译)或源代码,我将是一个快乐的开发人员.
I cannot figure out how to change this heading. I can't even find the source code for it properly. If someone could tell me the string(We use wpml for string translation) or the source code I would be a happy developer.
您要查找的模板位于 order/order-details.php
但是由于WooCommerce模板似乎无法在您的主题中工作,因此您可以尝试以下替代方法:
But as WooCommerce templates doesn't seem to work in your theme you can try this alternative:
add_filter('gettext', 'changes_in_thank_you', 100, 3 );
function changes_in_thank_you( $translated_text, $text, $domain ) {
if( $text === 'Order details' ) {
$translated_text = __( 'Your replacement text', $domain );
}
return $translated_text;
}
代码进入活动子主题(或活动主题)的function.php文件.
Code goes in function.php file of the active child theme (or active theme).
应该可以.
要专门定位已收到订单"页面,您可以替换:
To target specifically "Order received" page you can replace:
if( $text === 'Order details' ) {
作者:
if( $text === 'Order details' && is_wc_endpoint_url( 'order-received' ) ) {
在WPML中:
1)在主题和插件本地化" 中,您可以加载扫描该插件的"Woocommerce"插件的可翻译文本.
2)在字符串翻译" 中,您应该能够找到woocommerce域的字符串 'Order details'
并更改您的yranslation语言...
1) In "Theme and plugins localization" You can load the translatable text for "Woocommerce" plugin scanning this plugin.
2) In "String translations" you should be able to find the string 'Order details'
for the woocommerce domain and change the yranslation for your language…