I followed the Settings API instructions @ https://woocommerce.com/document/settings-api/#section-1 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)],
],
];
Open
Last updated: May 19, 2023
0 comments
Log in to comment on this feature request.