I want to add extra input fields to woocommerce cart page, yet I found one hook woocommerce_proceed_to_checkout
of cart page.
I also have to update and get values of custom fields, I have questions:
1) How to save datepicker_checkout
input field?
2) How to get value of this field when I calling insert_input_text_to_checkout
function from woocommerce_proceed_to_checkout
hook?
This code is only add an extra to cart page:
add_action( 'woocommerce_proceed_to_checkout', 'insert_input_text_to_checkout' );
function insert_input_text_to_checkout($checkout)
{
woocommerce_form_field( 'datepicker_checkout', array
(
'type' => 'text',
'class' => array('my-field-class form-row-wide'),
'id' => 'datepicker_checkout',
'label' => __('Select Date'),
'placeholder' => __('dd/mm/yyyy'),
'required' => true,
)/*, how to get value of 'datepicker_checkout' ? */);
}
From my tutorial on customizing the WooCommerce checkout here is an example of adding a field to checkout.