在 Woocommerce 的結帳頁面中,我嘗試更改“帳單詳細信息”和“運送到其他地址?”的標簽。到其他文本中,但是當我輸入如下 2 個類似的代碼時,它只更改一次:“帳單詳細信息”確實更改為“您的帳單信息”,但“運送到不同地址”卻沒有。請幫忙。//Change the Billing Address checkout labelfunction 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 中所有標簽文本的任何方法?
1 回答

哈士奇WWW
TA貢獻1799條經驗 獲得超6個贊
試試這個代碼。
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing details' :
$translated_text = __( 'Your billing info', 'woocommerce' );
break;
case 'Ship to a different address?' :
$translated_text = __( 'other shipping address?', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
- 1 回答
- 0 關注
- 146 瀏覽
添加回答
舉報
0/150
提交
取消