Get more for your money each Wednesday with big savings on selected extensions. Shop this week's deals.
Product Icon

WooCommerce

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 @ 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)],
],
];

Author

redes6039

Current Status

Open

Last updated: May 19, 2023

0 comments

Log in to comment on this feature request.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.