woocommerce_form_field pass array to select options
-
Hi, I’m trying to add a custom select field to the checkout page and I’m using the function woocommerce_form_field to add one.
I’m trying to pass an array to the options so that I don’t have to manually write all the possible options.
Here is the code I currently have (which doesn’t work).
woocommerce_form_field( 'store_selection', array( 'type' => 'select', 'class' => array('my-field-class form-row-wide'), 'label' => __('Fill in this field'), 'placeholder' => __('Enter something'), 'options' => array($stores['value'] => $stores['option']), ), $checkout->get_value( 'store_selection' ));It’s this part that I don’t get how to use properly:
‘options’ => array($stores[‘value’] => $stores[‘option’]),Can anyone help with this issue?
Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘woocommerce_form_field pass array to select options’ is closed to new replies.