在订单接收页面('woocommerce_thankyou
')上有一个表格,其中包含订单详细信息标题“订单详细信息” (Ordredetaljer
用我的母语)。
我不知道如何更改此标题。我什至无法正确找到它的源代码。如果有人可以告诉我字符串(我们使用 wpml 进行字符串翻译)或源代码,我将是一个快乐的开发人员。
最佳答案
您要查找的模板位于order/order-details.php
但由于 WooCommerce 模板似乎不适用于您的主题,您可以尝试以下替代方案:
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 文件中。
应该可以。
要专门定位“已收到订单”页面,您可以替换:
if( $text === 'Order details' ) {
作者:
if( $text === 'Order details' && is_wc_endpoint_url( 'order-received' ) ) {
In WPML:
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…
关于php - 更改 Woocommerce 订单接收页面中的特定订单详细信息文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48267068/