我目前在我的子主题的 functions.php 文件中有一些代码,它应该在我的 WooCommerce 结帐页面上将“账单详细信息”更改为“运输详细信息”。
但是,当我更新到 WooCommerce 3.0 时,代码片段停止工作。下面是我使用的代码。
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing Details' :
$translated_text = __( 'Shipping Details', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
我真的很想要一个适用于 WooCommerce 3.0 的代码片段。
最佳答案
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing details' :
$translated_text = __( 'Billing Info', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
使用 WooCommerce 3.0.6 测试正常
关于php - 在 WooCommerce 结帐页面上将 "Billing Details"文本更改为 "Shipping Details",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44419189/