在我的设计中,我有非标准的计费字段标签和标记。例如“Town / City *”应该是“Province *”。
我使用过 WOO 文档和 filter woocommerce_billing_fields。它适用于类名、占位符、创建新字段。但我无法触及已更改的标签。
$out_arr['billing_city']['class'][0] = 'form-row-first';
$out_arr['billing_city']['label'] = __('Province', 'woocommerce');
$out_arr['billing_postcode']['label'] = __('Zipcode', 'woocommerce');
Run Code Online (Sandbox Code Playgroud)
并使用var_dump新$out_arr数组显示正确的标签
["billing_city"]=>
array(4) {
["label"]=>
string(8) "Province"
["required"]=>
bool(true)
["class"]=>
array(2) {
[0]=>
string(14) "form-row-first"
[1]=>
string(13) "address-field"
}
["autocomplete"]=>
string(14) "address-level2"
}
Run Code Online (Sandbox Code Playgroud)
但我在前端仍然有旧标签。请问有什么建议吗?