WooCommerce:“结帐”页面中的“帐户密码”字段 [英] WooCommerce: Account Password Field in Checkout page
问题描述
我的主要目标是更改创建帐户结帐,以将电子邮件注册为用户名。我想到的简单方法是将帐户密码从密码更改为电子邮件,以覆盖 user_login
。
My main goal is to change the "create an account" checkout to register the email as a username. The easy way I thought of was changing "Account Password" from password to email to override user_login
.
但是,我似乎找不到密码文本框的来源。我知道这是我在 form-billing.php
下所需的代码,但是由于存在我不确定如何只显示密码循环
。
However, I can't seem to find where the "Password" text box is coming from. I know that this the code I needed under form-billing.php
, but I am unsure how only password is showing considering there's a for-loop
.
<?php foreach ( $checkout->checkout_fields['account'] as $key => $field ) : ?>
<?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
<?php endforeach; ?>
任何建议都值得赞赏。
Any advice is appreciated.
推荐答案
或者您可以通过以下方式将这段代码放入您的function.php中,更新不会覆盖它:
Or you can put this code in your function.php this way, an update doesn't overide it :
add_filter( 'woocommerce_checkout_fields' , 'custom_wc_checkout_fields' );
function custom_wc_checkout_fields( $fields ) {
$fields['account']['account_password']['placeholder'] = '';
return $fields;
}
这篇关于WooCommerce:“结帐”页面中的“帐户密码”字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!