• Resolved edouardcoleman

    (@edouardcoleman)


    Hello,

    Do you know how to remove (not replace) the “choose an option” from the attribute dropdown selectors ?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Try woocommerce_dropdown_variation_attribute_options_args filter and set show_option_none arg to false.

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Howdy!

    See if this works:

    add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'wc_remove_options_text');
    function wc_remove_options_text( $args ){
        $args['show_option_none'] = ' ';
        return $args;
    }

    This custom code should be added to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as Code Snippets.

    Cheers!

    Thread Starter edouardcoleman

    (@edouardcoleman)

    Thanks! It removes the “choose an option” but let a blank selection instead…

    To have only attributes I just removed the space between ‘ ‘ in your code. I m not sure its the best way as I don’t know anything about php, but it works..

    add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'wc_remove_options_text');
    function wc_remove_options_text( $args ){
        $args['show_option_none'] = '';
        return $args;
    }

    Please let me know if there is a more proper way.

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Howdy!

    Ah, yes, the blank line was a mistake ?? Glad it’s working.

    I don’t know of a more elegant and clean way, sorry.

    You could always override the single-product/add-to-cart/variable.php file if you’d like.

    Cheers!

    Thread Starter edouardcoleman

    (@edouardcoleman)

    Ok thanks for your help!

    Thanks a lot, to you, Rynald0s and edouardcoleman !!!

    It would be good if Woocommerce reshaped the entire system to make it a lot easier for customisations….

    Woocommerce is a fantastic e-commerce solution but it really bugs me

    What would be good if there was a whitelabel file where certain values could be changed, similar to a language file.

    Interspire (Big Commerce) has a language file called whitelabel, i was able to do just about anything in that system without real coding knowledge….

    I really hope that Automatic can streamline this beautiful system to make it easy for users to customise it without really knowing code.

    It really is a bug bear……….

    LISTEN TO YOUR USERS WOOCOMMERCE ??

    • This reply was modified 7 years, 3 months ago by yodunnit.

    Hello!

    For anyone else that comes across this thread. Here is a solution that worked for me,

    Add this to your functions.php file.

    add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'wc_remove_options_text');
    function wc_remove_options_text( $args ){
        $args['show_option_none'] = false; //Instead of giving it a blank value, you return false
        return $args;
    }

    Hope that helps.

    • This reply was modified 6 years, 12 months ago by Con Stambo.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to to remove “choose an option”’ is closed to new replies.