0

In Woocommerce user can also create account in the checkout process. At this point, I am trying to add some extra fields (like Email, Password confirmation & checkbox for 'email me') if user select "Create an account?" checkbox (image attached for reference).

enter image description here

At present it only show "Create account password" fields. But I want to add 3 more fields after the "Create account password" like - password confirmation , Email confirmation & checkbox for email me.

How can i add this functionality? Which action hook should i have to use for storing the that data.

I've tried the following - : -

I used filter woocommerce_checkout_fields for adding the extra fields.It working but it only displaying the fields before the "Create an account" checkbox. I am following this link for adding the extra fields - add a custom checkout billing field under the last name in WooCommerce

i am using the following code to add confirm E-mail Text Box

    add_filter('woocommerce_checkout_fields', 'custom_woocommerce_checkou_form_fields');
    function custom_woocommerce_checkout_form_fields( $fields )
{
      $fields['billing']['billing_email_cnfrm'] = array(
        'label'       => __('Please Confirm Email Address', 'woocommerce'), // Add custom field label
        'placeholder' => __('Please Confirm Email Address', 'woocommerce'), // Add custom field placeholder
        'required'    => true, // if field is required or not
        'clear'       => false, // add clear or not
        'type'        => 'text', // add field type
        'class'       => array('form-row form-row-wide'),   // add class name
    );
}

Similarly I added the checkbox also - (Image attached) enter image description here

Any Advice Please.

Siddharth
  • 99
  • 10
  • a bit conf by the question, you have already added these fields in the form. What do you want to do now ? If user clicks on registration, and if you want to add field for user registration then the form the the hooks are different ! – Alice Nov 25 '21 at 06:19
  • Thanks @Alice for reply,I want to show these additional fields when user will check Create Account? checkbox. Setting of priorities is not working in this case – Siddharth Nov 25 '21 at 06:28

0 Answers0