php - Add a custom field to checkout form in Woocommerce -


i want add custom field checkout form of woocommerce. field showing how want but, name , id attribute wrong. here's function create field.

// hook in add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );  // our hooked in function - $fields passed via filter! function custom_override_checkout_fields( $fields ) {      $fields['billing']['billing_infos'] = array(         'type'      => 'textarea',         'label'     => __('notes de la commande', 'woocommerce'),     'placeholder'   => _x('commentaires concernant votre commande', 'placeholder', 'woocommerce'),     'required'  => false,     'class'     => array('form-row-wide'),     'clear'     => true      );       return $fields; } 

here's how call in form:

<?php woocommerce_form_field( $checkout->checkout_fields['billing'], $checkout->checkout_fields['billing']['billing_infos'], $checkout->get_value( 'billing_infos' ) ); ?> 

when inspect field get:

<p class="form-row form-row-wide woocommerce-validated" id="array_field"><label for="array" class="">notes de la commande</label><textarea name="array" class="input-text " id="array" placeholder="commentaires concernant votre commande" rows="2" cols="5"></textarea>                 </p> 

i solved problem. first argument of function calling wrong.

here's how should call it:

<?php woocommerce_form_field( 'billing_infos', $checkout->checkout_fields['billing']['billing_infos'], $checkout->get_value( 'billing_infos' ) ); ?> 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -