• I have situations where I want to hide only specific addons. I tried modifying the js file to include an “else if” that would target a specific product and only the specific addons I wanted hidden. That didn’t work for some reason…the conditionals were correct as far as I could tell. Any ideas on how to make it work?

    function style_add_ons(bool)
        {
            if ( bool == 'no' )
            {
                $('.product-addon').css('display', 'block')
            }
            else if ( is_single('1786') && ( bool == 'yes' ) )
            {
                $('.product-addon-unlimited-revisions').css('display', 'none');
            }
            else
            {
                $('.product-addon').css('display', 'none');
            }
        }

    That said…this would be a feature request given the fact that the addons all have their own, specific assigned CSS tags and the fields could be easily pulled from the database. So..in theory…if you check the box you already have in the variable, it would display a subset of checkboxes below in a row where you can check specific ones to hide only while leaving the remainders visible.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Kahil

    (@kahil)

    I have figured out a way to make it happen with this edit:

    function style_add_ons(bool)
        {
            if ( bool == 'no' )
            {
                $('.product-addon').css('display', 'block')
            }
            else
            {
                $('.product-addon-source-file, .product-addon-unlimited-revisions').css('display', 'none');
            }
        }

    In this case, I edit the js file to target just the specific addons I want. For me, this works as I don’t really have any products where I want to clear out all of the addons. Maybe this will give you an idea of how to implement it so that we can hide all of them, or just the ones we want.

    Hy @kahil,

    Thanks for the information, I have noted this and added to our milestone list we will work on this in a future release.

    Thanks 🙂

    Thread Starter Kahil

    (@kahil)

    @angelleyesupport

    One way to do this that comes to mind and would fit in great with current WP and WooCommerce code would be how saved attributes are handled. See below.

    In regards to this plugin, if a user ticks the checkbox it displays a field like that which already has all of the product add-ons for that specific product listed. They would be all the add-ons which are hidden. The user can then remove the ones which they would like to keep visible. Again, all the add-ons in the field would be the ones which get hidden.

    That said… I have noticed that sometimes the script isn’t acting very quickly. Sometimes it takes a few seconds to show hide things.

    Also, another feature request would be that if a variation is selected and if any of the add-ons which are hidden were ticked/selected, then they get unticked/unselected when hidden. The reason for this is if a user is playing around with options and had a variation selected and some add-ons, then they select a different variation where add-ons are hidden, the value of those add-ons are still added to the total price. That means the user has to go back to the variation setup they had before, untick/unselect, then go back and change variations to get an accurate total. As you probably know, customers can be finicky when it comes to how easy or difficult the ordering process is…which in turn can affect sales.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Target specific addons only?’ is closed to new replies.