I'm adding extra fields to the checkout page in WooCommerce, I can add basic fields like a text box, but need to add a (multi) select box, where the user can choose multiple items. I've figured out how to add a select box through code, like this:
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
woocommerce_form_field( 'my_field_name', array(
'type' => 'select',
'class' => array('my-field-class form-row-wide'),
'label' => __('Fill in this field'),
'placeholder' => __('Enter something'),
'options' => array(
'Buick' => __('Buick', 'woocommerce' ),
'Ford' => __('Ford', 'woocommerce' )
)
), $checkout->get_value( 'my_field_name' ));
echo '</div>';
}
But that's just a single select drop down.
Can I do something similar for a multi-select?
Or do you have a WooCommerce extension that'd you recommend?
Please advice, thanks in advance!