【发布时间】:2019-07-15 05:42:43
【问题描述】:
在 Woocommerce 的结帐页面中,我尝试更改“账单明细”和“运送到不同地址?”的标签。到其他文本中,但是当我输入如下 2 个类似代码时,它只更改一次:“帐单详细信息”确实更改为“您的帐单信息”,但“运送到不同地址”没有。 请帮忙。
//Change the Billing Address checkout label
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing details' :
$translated_text = __( 'Your billing info', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
function shipchange( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Ship to a different address?' :
$translated_text = __( 'other shipping address?', 'woocommerce' );
break;
}
return $translated_text;
}
关于如何更改购物车和结帐页面 Woocommerce 中所有标签文本的任何方法?
【问题讨论】:
-
是的,看起来您只为第一个功能添加了过滤器。您可以为第二个功能添加过滤器或将两个功能合二为一,如下面的答案所示。
标签: php woocommerce