1
votes

I want to add an custom checkbox for agreeing to terms and condition on a WooCommerce registration form. I did that, but how do I make that checkbox appear between the Password and Register Buttons. Here is a link to my Registration form: https://otpeople.com/my-account/

It's showing there, but I want it on bottom of all fields, and a link to my terms and condition page.

Code:

<?php

   function wooc_extra_register_fields() {

 ?>

    <p class="form-row form-row-wide">

     <label for="reg_billing_first_name"><?php _e( 'Full Name', 'woocommerce' ); ?><span class="required">*</span></label>

     <input type="text" required class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" />

   </p>

     <div class="clear"></div>



   <p class="form-row form-row-wide">

     <label for="reg_billing_phone"><?php _e( 'Mobile Number', 'woocommerce' ); ?><span class="required">*</span></label>

     <input type="Number" required class="input-text" name="billing_phone" id="reg_billing_phone" value="<?php if ( ! empty( $_POST['billing_phone'] ) ) esc_attr_e( $_POST['billing_phone'] ); ?>" />

   </p>



   <p class="form-row form-row-wide">

     <label for="reg_num"><?php _e( 'MCI Registration Number', 'woocommerce' ); ?><span class="required">*</span></label>

     <input type="text"  required class="input-text" name="reg_num" id="reg_num" value="<?php if ( ! empty( $_POST['reg_num'] ) ) esc_attr_e( $_POST['reg_num'] ); ?>" />

   </p>

   <p class="form-row form-row-wide">

     <label for="Year_of_reg"><?php _e( 'MCI Year of Registration', 'woocommerce' ); ?><span class="required">*</span></label>

     <input type="Number" required class="input-text" name="Year_of_reg" id="Year_of_reg" value="<?php if ( ! empty( $_POST['Year_of_reg'] ) ) esc_attr_e( $_POST['Year_of_reg'] ); ?>" />

   </p>


   <p class="form-row form-row-wide">

     <label for="qualification"><?php _e( 'Qualification', 'woocommerce' ); ?><span class="required">*</span></label>

     <input type="text" required class="input-text" name="qualification" id="qualification" value="<?php if ( ! empty( $_POST['qualification'] ) ) esc_attr_e( $_POST['qualification'] ); ?>" />

   </p>
      <label for="reg_billing_check_box"><?php _e( 'Agree to Terms & Condition', 'woocommerce' ); ?><span class="required">*</span></label>


    <input type="checkbox" class="input-text" name="billink_checkbox" id="reg_billing_first_name" value="&lt;?php if ( ! empty( $_POST['billing_checkbox'] ) ) esc_attr_e( $_POST['billing_checkbox'] ); ?&gt;"/>
1

1 Answers

2
votes

I guess you have this start section of registration area with this code

add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' );

You can use _end part instead, in that case your checkbox will appear after all fields:

add_action( 'woocommerce_register_form_end', 'wooc_extra_register_fields' );

To make submit button to be at bottom, use this CSS:

.register .woocommerce-Button {position: absolute !important; bottom: 45px;}
.register {padding-bottom:70px !important}