Mobile App Refresh Campaign [Banner] 2024

Product Icon

Product Add-Ons

by  Woo
Offer add-ons like gift wrapping, special messages or other special options for your products.

Product add-ons default values

Ability to set default values for add-ons created with Product Add-ons.

Author

Current Status

Planned

Last updated: August 15, 2022

40 comments

Log in to comment on this feature request.

  1. samwoodsid says:

    I realized that you can just remove the first “Select…” option from the .wc-pao-addon-select and it will set the next one as the default:

    jQuery(document).ready(function(){
    jQuery(‘.wc-pao-addon-select’).each(function(){
    jQuery(this).find(‘option:first’).remove();
    });
    });

    I have many different product add-ons, global and product specific, and having to set code for every select dropdown would be difficult and unmanageable. The client wouldn’t be able to use it either.

    This way if you need a 0 value you can just create the option for the add-on and label it “None”

  2. markofnone says:

    This plugin has default values for all field types built-in: https://www.studiowombat.com/plugin/advanced-product-fields-for-woocommerce/

  3. Gareth Harris says:

    You can add default values for all field types using the WooCommerce Product Add-Ons Ultimate plugin: https://pluginrepublic.com/wordpress-plugins/woocommerce-product-add-ons-ultimate/.

  4. poehah says:

    It’s strange that this has not been added yet after so long. For anyone looking, this feature is already included in the Advanced Product Fields plugin from Studio Wombat at https://www.studiowombat.com/plugin/advanced-product-fields-for-woocommerce/

  5. refillerydistrict says:

    If you want to change the function to something else, you just need to find which function that is.

    Here are the available functions I could which need to be changed in the code for your use case:

    wc-pao-addon-custom-price
    wc-pao-addon-checkbox-group-required
    wc-pao-addon-custom-text

  6. refillerydistrict says:

    For anyone wanting to set default values, 2023 showed us that we have this beautiful new tool called Chat GPT that can customize code for things like this! I wanted to have my checkbox for a bottle deposit selected by default so here is the code it generated and it works!

    function add_custom_javascript() {
    ?>

    jQuery(document).ready(function(){
    jQuery(‘.wc-pao-addon-checkbox[value=”paper-bag-fee”]’).prop(“checked”, true);
    });

    <?php
    }
    add_action( 'wp_head', 'add_custom_javascript' );

    Add this to your functions.php in your child theme or parent theme if you don't use a child theme.

  7. milkstyles says:

    Cant believe you cannot do this! I just tried, this sucks! please add this!

  8. Lee says:

    I would also like to have the option to set default values for checkboxes and radio buttons.

  9. Sofie Ɩstlund says:

    The price is only calculated and displayed when all addons have been selected. In this respect, it would make sense to be able to specify a default value

  10. victor says:

    its stupid dont have this option. -.-!

  11. Samuel says:

    Yes , please add the option to be able to create a draft product with a set of default parameters

  12. Jay says:

    A dropdown of pre-configured values. I want customers to be able to select and apply suggested blocks of text to personalise their product e.g. special messages when buying gifts for others. Would be great if customers could edit the font of the text e.g. WYSIWYG editor/textarea

  13. DL says:

    if( $(‘[class*=”wc-pao-addon-wrap”]’).length )
    $(‘[class*=”wc-pao-addon-wrap”]:first-of-type input’).prop(‘checked’, true);

  14. Anonymous says:

    f( $(‘[class*=”wc-pao-addon-wrap”]’).length )
    $(‘[class*=”wc-pao-addon-wrap”]:first-of-type input’).prop(‘checked’, true);

    It does not work!!!

    Does anyone have a fix for that?

  15. Matteo says:

    I must say I’m really surprised such basic feature is not there yet. I’ll look for another plugin because of this feature missing.

  16. Anonymous says:

    Incredible its not included… This is really important and basic in all similar plugins.

  17. Chiu says:

    Did some research online and managed to put together a piece of code that worked for me! This will remove “Select an Option…” on the dropdown box (which appears if you set it to “Required”) and then set your first option to be the default option. I am not a developer though, so if this code is not working for you, please approach others. Just sharing what worked for me šŸ™‚

    jQuery(document).ready(function(){
    jQuery(‘.wc-pao-addon-select option:contains(“Select an option…”)’).remove();
    jQuery(‘.wc-pao-addon-select’).prop(‘selectedIndex’, 0);
    });

    Paste this in a plugin such as https://wordpress.org/plugins/custom-css-js/ with their “Add JS” option.

    You can remove the line
    jQuery(‘.wc-pao-addon-select option:contains(“Select an option…”)’).remove();
    if you prefer to keep the “Select an option…”

    Screenshot: https://share.getcloudapp.com/Blu5YwlW

  18. Anonymous says:

    please add this out of the box… kinda shocked it isn’t an option

  19. Gene says:

    Yes, please add the option to set default values for checkboxes and radio buttons, thanks!

  20. TechTone says:

    I agree 100%. Not everyone knows and be assumed how to deal with coding. This is a must feature out-of-box.

  21. Sven Adam says:

    Sorry, keusta, I don’t know Java Script

  22. simon says:

    I really need this feature!

  23. Samuel says:

    Certainly an absolute necessity have fundamental element in this extension. Why have clients play out an additional progression of choosing a default esteem where it ought to be “default” without the need to looking over a dropdown list and tapping on it!

  24. Julien says:

    I just want to removed the word ‘None’ or ‘Select an option’

  25. Anonymous says:

    In a multi language website (wpml), the name of the select changes with the language selected.
    So selecting the default value by jquery has to be done for every language. šŸ™

    So I think for a proper application design this feature should be implemented in the plugin.