Mailchimp Banner | Q2 2024

added by Latoya

Product Icon


by  Woo
Sell online with the flexible, customizable eCommerce platform designed to grow with your business. From your first sale to millions in revenue, Woo is with you. See why merchants trust us to power 3.4 million online stores.

Settings API (multi)select size attribute

I followed the Settings API instructions @ to create a field of type multiselect. I would like to request to extend the WC_Shipping_method->form_fields array variable that it supports the HTML select attribute “size” to allow to determine the height of the multiselect box. Since there are so many possible attribute variations, may be there should be simply an “attribute” element where the attributes that are not “class” or “style” (css) can be defined in one string.

I know that the height of a select / textarea field can also be determined with css / style, but the easier way is to simply set the absolute number of rows, columns in stead of calculating the height, which can be relative to other CSS.

example of this:
$this-> form_fields = [
‘applicable_zones’ => [
‘title’ => __(‘Applicable Shipping Zones’, ‘woocommerce’),
‘description’ => __(‘Enable this shipping method for the selected zones (use ctrl-click)’, ‘woocommerce’),
‘type’ => ‘multiselect’,
‘default’ => [‘2′,’3′,’4’],
‘options’ => $this->shipping_zones,
// ‘css’ => sprintf(‘height: %sem’,count($this->shipping_zones)*1.3),

‘attributes’ => [‘size’ => count($this->shipping_zones)],



Current Status


Last updated: May 19, 2023


Log in to comment on this feature request.