How I can add custom fields into WooCommerce reset password form?
Because on the register client I need to get email verify and setup they own account password, and also I want to let them set up their first name and last name in the form.
For example, I want to add those fields to the form:
<p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first">
<label for="account_first_name"><?php esc_html_e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="account_first_name" id="account_first_name" autocomplete="given-name" value="" />
</p>
<p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last">
<label for="account_last_name"><?php esc_html_e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="account_last_name" id="account_last_name" autocomplete="family-name" value="" />
</p>
2
Answers
Did you try using
woocommerce_resetpassword_form
hook? You should be able to add custom fields using the above-mentioned hook. You might also have to handle the form data on submission.for example:
The following will:
The complete code:
Code goes in functions.php file of your child theme (or in a plugin). It should work.