php - Adding select field after order notes for WooCommerce checkout -


i'm trying add bunch of custom fields @ end of checkout form collects additional data we'd need process order.

this have:

add_action( 'woocommerce_after_order_notes', 'student_info_fields' );  function student_info_fields( $checkout ) {      echo '<div id="student_info"><span>the following information below used create account.</span>';      //this adds student_name field      woocommerce_form_field( 'student_name', array(         'type'        => 'text',         'class'       => array('form-row-wide'),         'label'       => __('student name'),         'placeholder' => __('eg: "john smith", "johnny", etc'),         'required'    => 'true',     ), $checkout->get_value( 'student_name' ));      /* have 2 other text fields here follow same syntax student_name */      //this adds student_gender field      woocommerce_form_field( 'student_gender', array(        'type'        => 'select',        'label'       => __('gender', 'woocommerce'),        'placeholder' => _x('', 'placeholder', 'woocommerce'),        'required'    => 'true',        'options'     => array(           'male' => __('male', 'woocommerce' ),           'female' => __('female', 'woocommerce' )        ),     ), $checkout->get_value( 'student_gender' ));      echo '</div>';  } 

the text fields seem work, when add student_gender field, page breaks (all white screen). i'm little skeeved out calling options array within student_gender array, calling $checkout ->get_value... line after declare each field, don't know do.

any direction can give me helpful cracking nut. sticking it!

i looked @ , figured out screwing up. say, pointed me toward label declaration, don't think using proper syntax.

i changed code to:

    //this adds student_gender field  woocommerce_form_field( 'student_gender', array(     'type'        => 'select',     'label'       => __('student gender'),     'placeholder' => _x('', 'placeholder', 'woocommerce'),     'required'    => 'true',     'options'     => array(            'male' => __('male', 'woocommerce' ),            'female' => __('female', 'woocommerce' )     ), ), $checkout->get_value( 'student_grade' )); 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -