WooCommerce checkout field for date input

I have created a few custom checkout fields using plugins before, and their markup look similar to this:

<label for="billing_wcj_checkout_field_1"
     class="">Date</label><input type="text" class="input-text " 
    name="billing_wcj_checkout_field_1" id="billing_wcj_checkout_field_1" 
    placeholder=""  value="" display="date" />

However, when I follow documentation and created custom fields like following:

Read More
    woocommerce_form_field(
       'date', array(
           'type' => 'text',
           'class' =>array('form-row-first'),
           'label' => __('Date'),
           'required' => false
       ), $checkout->get_value( 'date' ));

I am not able to set neither the display type nor the input class "hasDatepicker"

Any help or guidance is much appreciated.

Related posts

1 comment

  1. You can add class for the input with adding this line to the array: ‘input_class’ => array(‘hasDatepicker’)

    woocommerce_form_field(
       'date', array(
           'type' => 'text',
           'class' =>array('form-row-first'),
           'label' => __('Date'),
           'required' => false,
           'input_class' => array('hasDatepicker')
       ), $checkout->get_value( 'date' ));
    

Comments are closed.