我想在woocommerce购物车页面添加额外的输入字段,但我找到了一个购物车页面的woocommerce_proceed_to_checkout
个钩子。
我还必须更新并获取自定义字段的值,我有疑问:
1)如何保存datepicker_checkout
输入字段?
2)当我从insert_input_text_to_checkout
钩子调用woocommerce_proceed_to_checkout
函数时,如何获得该字段的值?
此代码仅向购物车页面添加额外内容:
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' ? */);
}