I created a custom select checkout field and the field works great. When I add a selectWoo or a select2 class to it, it functions like a select2 box but says no results found. The html options are there.
Does select2 or selectWoo not work for a custom field, or did I do something wrong?
Field is:
woocommerce_form_field( 'student_name', array(
'type' => 'select',
'class' => array('my-field-class form-row-wide ram_select2'),
'label' => __('Student'),
'placeholder' => __('Student Name'),
'required' => true,
'options' => $patients,
), $checkout->get_value( 'student_name' ));
I initiated the class in an enqueued js script:
(function($) {
$(document).ready(function() {
$('.ram_select2').selectWoo();
});
})(jQuery);
I created a custom select checkout field and the field works great. When I add a selectWoo or a select2 class to it, it functions like a select2 box but says no results found. The html options are there.
Does select2 or selectWoo not work for a custom field, or did I do something wrong?
Field is:
woocommerce_form_field( 'student_name', array(
'type' => 'select',
'class' => array('my-field-class form-row-wide ram_select2'),
'label' => __('Student'),
'placeholder' => __('Student Name'),
'required' => true,
'options' => $patients,
), $checkout->get_value( 'student_name' ));
I initiated the class in an enqueued js script:
(function($) {
$(document).ready(function() {
$('.ram_select2').selectWoo();
});
})(jQuery);
Try this way:
woocommerce_form_field( 'student_name', array(
'type' => 'select',
'class' => array('my-field-class','form-row-wide','ram_select2'),
'label' => __('Student'),
'placeholder' => __('Student Name'),
'required' => true,
'options' => $patients,
), $checkout->get_value( 'student_name' ));