Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #3226280
Unselect the checkbox to the components
Closed

Comments

  • Cleverson started the conversation

    Hello everyone, I would like to use the checkbox for my composite products, however, by default they are all selected. I would like them all to be unselected and the customer to choose the ones they want. It's possible?

    Another doubt is about the main image of the product. I would like it to change with each component choice made by the client, isn't that possible?

  •  1,226
    Dustin replied

    Hi Cleverson,

    #1. To uncheck checkboxes by default, please add the below custom code (How to add custom code?)

    add_filter( 'wooco_component_checkbox_checked', 'wooco_component_checkbox_unchecked', 99, 2 );
    function wooco_component_checkbox_unchecked( $checked, $component ) {
        if ( $component['optional'] === 'yes' ) {
            return false;
        }
        return $checked;
    }

    #2. I can help you add a snippet to REPLACE the main product's image with the selected product's image. We can't set a new image based on selected component products. Please watch the screen record video https://www.screencast.com/t/nc7dUOBv

    If you want that, please add the below custom code (How to add custom code?)

    add_action( 'wp_footer', 'wooco_change_main_image_1' );
    function wooco_change_main_image_1() {
        ?>
        <style>
            .woocommerce-product-gallery-new img {
                width: 100%;
                height: auto;
            }
            .wooco_gallery {
                cursor: pointer;
            }
        </style>
        <script type="text/javascript">
          jQuery(document).on('wooco_selected', function(e, selected, selection, component) {
            var img_full = selected.attr('data-imagefull');
            var select = selection.data('select');
            if (select > 0) {
              if (img_full != '') {
                jQuery('.woocommerce-product-gallery:not(.woocommerce-product-gallery-new)').
                    addClass('woocommerce-product-gallery-ori').
                    hide();
                if (jQuery('.woocommerce-product-gallery-new').length) {
                  jQuery('.woocommerce-product-gallery-new .wooco_image').html('<img src="' + img_full + '"/>');
                  jQuery('.woocommerce-product-gallery-new').show();
                } else {
                  jQuery(
                      '<div class="woocommerce-product-gallery woocommerce-product-gallery--with-images woocommerce-product-gallery--columns-4 images woocommerce-product-gallery-new"><div class="wooco_image"><img src="' +
                      img_full + '"/></div><div class="wooco_gallery">← Back to gallery</div></div>').
                      insertAfter('.woocommerce-product-gallery-ori');
                }
              } else {
                jQuery('.woocommerce-product-gallery-new').hide();
                jQuery('.woocommerce-product-gallery-ori').show();
              }
            }
          });
          jQuery(document).on('click touch', '.wooco_gallery', function() {
            jQuery('.woocommerce-product-gallery-new').hide();
            jQuery('.woocommerce-product-gallery-ori').show();
          });
        </script>
        <?php
    }

    If this snippet doesn't work for your site. Please give me a composite products link on your site then I can check it then give a new snippet.

    Best regards,
    Dustin

  • Cleverson replied

    Hello Dustin, thanks for the support!

    The checkbox was resolved with the code, since the images are not changed when we click on the component.

    The idea is as follows:

    We sell airguns, and we offer a basic kit (main product) and with each accessory that the customer adds, the main photo is changed, adding the chosen component.

    can you help me?

    Thanks!


  •  1,226
    Dustin replied

    Thanks for the link!

    Do you mean when choosing component products, these products' images will be appended here https://www.screencast.com/t/xfDJ4xqT instead of completely replacing the main image?

    Best regards,
    Dustin

  • Cleverson replied

    No, I wanted the component image to be displayed in the main image, as in the video you showed me, but with the checkbox it didn't work

  •  1,226
    Dustin replied

    Yes, this snippet doesn't work for checkboxes.

    I think a better solution is open the quick view popup for each component product https://www.screencast.com/t/xHsRQyACu9

    And the result (screen record video) https://www.screencast.com/t/GNbyBCwrkrj

    Best regards,
    Dustin

  • Cleverson replied

    I thought this plugin would work for me, but I don't think so.

    The idea was to make it simple for the customer (who were having difficulties). Would you recommend any other solution?

    Again I explain what I want:

    I have a basic product (Main)
    I have several accessories for this main product, which can be purchased according to the customer's desire.

    I would like that for each accessory that the customer chooses, the main photo illustrates this choice and the price also changes.

    Can you help me?

  •  1,226
    Dustin replied

    If you want the price will change based on selections, please choose this option for Pricing https://www.screencast.com/t/GfgyyGLyEWyX

    Now, have only issues with the component products' images, right?

    If you want something like that https://www.screencast.com/t/nc7dUOBv, please send me your website credentials (wp-admin link, username, password) then I can do that for you. You also can create a dev/staging site with the same configurations then I'll work on it.

    Best regards,
    Dustin

  • Cleverson replied

    Dustin, unfortunately I found that I can do what I want with the native woocommerce variations. So the plugin I bought from you was useless to me.

    I could have the "7-Day Money-Back Guarantee"

    I would be happy, as I ended up not using the plugin.

    Thank you in advance for all your effort in helping me with the problem.

    Regards,

    Cleverson

  •  1,226
    Dustin replied

    We have processed your request and refunded this payment. It's sad to hear that our plugin doesn't meet your requirements.

    Hopefully, we could still have your interest and support of other promising plugins on https://wpclever.net

    Moreover, kindly check out other stunning free plugins from our WPClever team on http://wpclever.org

    Best regards,
    Dustin