Posted: 3 years ago
I created another plugin for WordPress. This time to customise the “choose an option” dropdown menu for product variations in WooCommerce. You can download it as a zip here.
The plugin gives you the ability to set a default label for all variation dropdowns by going to WooCommerce -> Settings -> Products -> Variation Dropdown Settings. From there, put in any text you would like to display instead of “Choose an option”.
You can also select whether to insert the name of the variation at the end of the label by selecting “Use attribute name”. As an example, if you set “Select a” as your custom drodpown and you had “ring size” and “color” as variations, the text it would display for each of these would be “Select a ring size” and “Select a color”.
In addition to these global options, you can also override these settings per product attribute. Edit a product and go to the product attribute. Underneath the “used for variations” checkbox you should see a text field. This gives you the same option as the global settings. The checkbox for inserting the attribute value isn’t here as it’s assumed that because you’re already editing the individual attribute, you can insert the name in the text field at the same time.
In a future update, I’m planning on adding options to global attributes so you don’t have to go into each product attribute if you want it to be different from the global setting.
Here’s the basis of the plugin that allows you to change the dropdown if you’d rather code something up yourself:
Using the ‘wc_attribute_label‘ function to retrieve the attribute label, you dynamically insert the name of the variation/attribute at the end of the customised option as well: