在Woocommerce中隐藏一些Checkout Fields问题 [英] Hide some Checkout Fields issue in Woocommerce
本文介绍了在Woocommerce中隐藏一些Checkout Fields问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
即使在使用
// woocommerce checkout page
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
return $fields;
}
我什至使用插件进行了测试,但问题仍然存在,它仍然在前端显示输入.
I even tested with a plugin and the problem is still there its still showing the input on the front-end.
添加代码后,您可以看到输入仍在显示,但比其他字段短:
推荐答案
"在特定情况下,您需要使用
woocommerce_default_address_fields
过滤器." 说因此,您应该尝试以下操作:So you should try instead this:
add_filter( 'woocommerce_default_address_fields', 'custom_checkout_fields' 20, 1 ); function custom_checkout_fields( $address_fields ) { unset($address_fields['company']); unset($address_fields['country']); unset($address_fields['state']); return $address_fields; }
代码进入您的活动子主题(或活动主题)的function.php文件中.
应该可以...
这篇关于在Woocommerce中隐藏一些Checkout Fields问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文