我正在尝试为 Woocommerce 结帐页面上的 billing_address_2 字段设置/显示标签,但找不到执行此操作的方法。有谁知道解决方案?
下面的代码(在其他领域工作正常)不能完成这项工作。
add_filter( 'woocommerce_checkout_fields' , 'custom_rename_wc_checkout_fields' );
function custom_rename_wc_checkout_fields( $fields ) {
$fields['billing']['billing_address_2']['label'] = 'Building number';
return $fields;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用WooCommerce建立一个网店.
确定的表单格式是没有标签,只有占位符.我一直在删除这样的标签:
<?php
// WooCommerce Checkout Fields Hook
add_filter( 'woocommerce_checkout_fields' , 'custom_wc_checkout_fields' );
// Change the format of fields with type, label, placeholder, class, required, clear, label_class, options
function custom_wc_checkout_fields( $fields ) {
//BILLING
$fields['billing']['billing_first_name']['label'] = false;
return $fields;
}
?>
Run Code Online (Sandbox Code Playgroud)
但由于我不想在任何地方贴标签,我想知道是否有办法立即删除所有标签.而不是单独通过它们.有人有想法吗?
谢谢!
编辑:
我意识到这可以通过添加一些css(显示无)来实现,但由于这不是一个非常干净的解决方案,我想知道是否还有其他方法可以实现这一点.