Support » Plugin: WooCommerce » Is there a way to remove "Choose an option" on variable products?

  • Resolved Tigerbite

    (@tigerbite)


    For example, I have t-shirts that come in different colors based on if it’s in women’s or men’s style.

    So I want to remove the “Choose an option” text from the variable drop down box so it has to be on Men’s or Women’s.

    Otherwise, all the colors show up, then the customer might try to change the style but wont be able to (until they change the color to choose an option) which can be a big mess and confusing to the normal stopper by.

    So, any ideas on how to get rid of this option so choose a style has to be set?

    Thanks!

    https://wordpress.org/plugins/woocommerce/

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author Mike Jolley

    (@mikejolley)

    You cannot remove it without code, but you can set the default in the ‘variation’ panel. Set that to mens or womens and it will pre-select.

    The default isn’t very helpful, since if you “accidentally” click it, but then don’t choose an option, it stays there.

    Where/what code would I need to change to get rid of “Choose an option”?

    -edit-
    I’m guessing it’s somewhere in the variable.php file, but I’m not…quite sure…what to touch, lol.

    Plugin Author Mike Jolley

    (@mikejolley)

    What would be the harm in that exactly? Amazon has a choose option.

    This function outputs it. You can turn off the option to show none https://github.com/woothemes/woocommerce/blob/master/includes/wc-template-functions.php#L1906

    To a smart person, none at all. Unfortunately, there are a lot of not so bright people out there and they might choose a color, then see it’s only in men’s (or women’s) and not realizing they can move the color option to “choose an option” to be able to select the other gender.

    The choose option itself isn’t the problem, it’s when you have multiple attributes and some of attribute 2 only work with attribute 1.

    I guess the main problem is, say a shirt only comes in red for men. Say, they pick the color red, before choosing the gender style. Then when they go to pick the gender style, the only option will be “Choose an option” or “Men’s”.

    Now if there was a way for “Women’s” to still show up then it reset the color choices, that would be great as well.

    This is basically how I want it to work, if something like this is possible.

    http://6dollarshirts.com/t-shirts/Nerd-Cat–p-11484.html

    (How you can change the style no matter what the color is on, but only certain colors appear for the style.)

    Make sense? And is it possible? 😀

    Plugin Author Mike Jolley

    (@mikejolley)

    This may or may not be suitable instead, but it sounds like you want all options to display, regardless of other selections in other fields.

    https://wordpress.org/support/topic/24-handling-for-20-variations?replies=1

    If there are > 20 variations, the conditional aspect is disabled and variations get pulled in via ajax. In theory, if you lowered that theshold to 1, you could make use of it.

    removing choose an option isn’t going to work in your case, because then either men or women will be chosen.

    Kind of, except I only want all options to display for style (the first drop down box – Men’s/Women’s) no matter what color you have selected. However, I only want men only colors to appear in the color (second drop down box) when Men is selected.

    But something tells me, this probably isn’t possible without a plugin and I’ve yet to find a plugin that does this. >_<

    Plugin Author Mike Jolley

    (@mikejolley)

    This might not be ideal either, but have you thought of merging them?

    I.e have one attribute only and have:

    mens – red
    mens – whatever
    womens – whatever

    Definitely not ideal. The best I have right now is just 2 separate products.

    Shirt #1 (Men’s)
    Then the attributes for color/size.

    and Shirt #2 (Women’s)
    Then the attributes for color/size.

    I was just trying to find a good way to make it one product and let you choose the style (men’s/women’s), color, and size (like the site I linked earlier.)

    Thanks for your help and suggestions though.

    Plugin Author Mike Jolley

    (@mikejolley)

    Yeah. It’s tricky because you want a conditional and a non conditional field 🙂 But if separate products work…

    I wished there was an option like that.
    I do confirm that there are a lot of people that don’t understand it.

    I did look at the website you linked and i like that way too.
    If you find a a way. Please let me know. I would love to have the “choose an option” removed and it will always select a product.

    Since 2.4.7 there is a new filter to accomplish that task. If you are still in need you can get the code from my public gist: https://gist.github.com/mensmaximus/b86032398f5229c509ab

    @mensmaximus Awesome bit of code, works a treat. Thank You 🙂

    @mensmaximus Thanks a lot! Really fantastic piece of code. Worked great. But what to do if you have a shop of 1000+ products??

    Do you have a code that will instantly get applied to the whole shop? Or a category?

    Thank you again!!!

    This code should be implented by default in WC =)

    @worldsdream

    To remove the text in general you can put the following code into your functions.php:

    add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'mmx_remove_select_text');
    function mmx_remove_select_text( $args ){
        $args['show_option_none'] = '';
        return $args;
    }
Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Is there a way to remove "Choose an option" on variable products?’ is closed to new replies.