woocommerce在输入字段上的自动对焦“ billing_first_name”
我有自定义结帐页面。首先,我要展示添加到购物车项目的内容,而不是使用此操作来显示帐单表单
<?php do_action( 'woocommerce_checkout_billing' ); ?>
页面滚动,这是因为名称字段上的自动对焦。
试图使用这样的过滤器
add_filter('woocommerce_billing_fields','disable_autofocus_billing_firstname');
function disable_autofocus_billing_firstname($fields) {
$fields['billing_first_name']['autofocus'] = false;
return $fields;
}
也试图用jQuery和Vanila JS效果模糊该领域。我缺少Woo的一些更新吗?谢谢!
I have custom checkout page. First I'm showing content with added to cart items and than using this action to show billing form
<?php do_action( 'woocommerce_checkout_billing' ); ?>
Page scrolls down because of the autofocus on first name field.
Tried to use filters like this one
add_filter('woocommerce_billing_fields','disable_autofocus_billing_firstname');
function disable_autofocus_billing_firstname($fields) {
$fields['billing_first_name']['autofocus'] = false;
return $fields;
}
Also tried to blur the field with jQuery and vanila JS no effect. Is there is some updates for Woo that I'm missing? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于覆盖核心字段,需要使用挂钩“ woocommerce_checkout_fields”,
您需要使用以下片段才能在结帐字段上禁用自动对焦:
For overriding core fields need to use the hook 'woocommerce_checkout_fields'
You need to use the snippet below in order to disable the autofocus on checkout field: