Custom Checkout Fields – Checkboxes
-
Hello! I’m trying to add some custom fields to the WooCommerce checkout form. Currently, I’m using the
woocommerce_checkout_fieldshook which is usually easy – for a radio I can add:$fields['billing']['_click_yes'] = array( 'type' => 'radio', 'label' => 'Click Yes', 'required' => 0, 'class' => array( 'form-row-first', 'custom-field', 'input-radio', ), 'options' => array( 'Yes' => ' Yes', 'No' => ' No', ), );And I can do something similar for a select dropdown list. The issue is checkboxes don’t appear to follow the same rules ( or I’m missing something obvious ). Here’s what I’m using for checkboxes:
$fields['billing']['_weekdays'] = array( 'type' => 'checkbox', 'label' => 'Days of The Week', 'required' => 0, 'class' => array( 'form-row-last', 'custom-field', 'input-checkbox', ), 'options' => array( 'Monday' => 'Monday', 'Tuesday' => 'Tuesday', 'Wednesday' => 'Wednesday', 'Thursday' => 'Thursday', 'Friday' => 'Friday', 'Saturday' => 'Saturday', 'Sunday' => 'Sunday', ), );What ends up appearing is the
labelparameter is shown with a checkbox before the text instead of the main title and the options all being checkboxes. Is there something I’m missing or is it just not capable of this yet?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Custom Checkout Fields – Checkboxes’ is closed to new replies.