How to Replace “Choose an option” with Attribute name in variation select menu in WooCommerce

In woocommerce, the product attributes used for variations will display as a select menu in product page. For example, if I had created an attribute named ‘Size’ and used it for variation, then a ‘Size’ select menu will appear in the product page containing attribute values (or configured terms) as options for a customer to choose from (like ‘Size’ select menu would have values such as “S, M, L, XL etc…”). The variation select menu will also have “Choose an option” as the first item, which (I felt) should have been as “Choose size” for size variation and “Choose color” for a color variation. It also makes sense, as the customer is going to choose size and color of the product.

If you are wondering how to replace “Choose an option” with corresponding attribute/variation name, then here’s how you can do that.

Fortunately, thomasfw@Stackoverflow had a solution to my problem – a big thanks to him.

1. Override ‘variable.php‘ file by copying it from ‘woocommerce/single-product/add-to-cart/variable.php‘ to your theme directory. For example; #your_theme_location/woocommerce/single-product/add-to-cart/variable.php. Well, you might need to take help from this link.

2. Once done, edit variable.php and lookout for the code as the one shown below (In woocommerce version 2.4.6, the below code was starting at line 31 and ends at line 41):

Replace it with the below code:

Once done, save ‘variable.php‘ file and refresh your product page to see ‘Choose an option” replaced with ‘Choose ’. That’s it!

Another way i found in where Plugin Drawer showed a easy way. This should allow you to change the default value text. Copy and paste this into your themes functions.php file. It may not be the best way to do it but it worked great for me.

NOTE: This will change the default value text throughout the entire site.

8 thoughts on “How to Replace “Choose an option” with Attribute name in variation select menu in WooCommerce”

  1. Thanks for posting the filter bit at the end. I remembered changing a lot of the checkout defaults like that but couldn’t remember the filter names. So much cleaner than the other things I was going to attempt.

  2. I’ve been exploring for a little for any high-quality articles or blog posts in this kind of house .

    Exploring in Yahoo I finally stumbled upon this web site.
    Studying this information So i’m glad to show that I’ve
    an incredibly excellent uncanny feeling I discovered just what
    I needed. I such a lot indubitably will make sure to do not
    overlook this website and provides it a look regularly.

  3. Due to updates of WC you rather might use a filter 😉 example:

Leave a Comment

Your email address will not be published. Required fields are marked *