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

Okay
  Public Ticket #2279759
Show the number of selected products
Closed

Comments

  • Damian Aramayo started the conversation

    Hello,

    Is there a way to show the number of selected products?

    For example:

    I have one category where the user can only select 5 products. The category has 14 different products.

    When the user has selected 2 products I want a legend under the bundle products and above the "ADD TO CART" button where it says: "You have selected 2 products".

    If the user didn't select anything yet, I still want the legend in my Wordpress page where it says "You have selected 0 products".


  •  767
    Janilyn replied

    Dear users,

    Welcome to WPClever Support Forum. This is a systematic notification.

    Thank you for reaching out to us. We have had a very successful, fruitful year thanks to your valuable support and cooperation last year. We are truly grateful for your interest and passion in our plugins. 

    To celebrate this and prepare for another marvelous year, we are having a long vacation from 24 to 27 January, 2020. So during this time period, all the support activities will be temporarily unavailable. We're still receiving your tickets but they will be held Pending until 28 January, 2020. After that time, support might still be a bit slower than normal as we're planning to conduct some major assessments of the system and operation. (Just a secret between you and me: We're running a really BIG project for WPClever.) But don't worry, we'll try our best to proceed your tickets respectively at the same time. 

    We're sorry for any inconvenience caused to you during this time. Hopefully, our dear users will understand and wait patiently for us. With high inspiration, we will come back better, faster and stronger to deliver you the best. 

    A thousand thanks to you all from WPClever team. We wish you all the best for the year of 2020. 

    From WPClever team with love.


    Janilyn T. - WPClever Support Agent

  •  1,281
    Dustin replied

    Hi Damian,

    Currently we already have the option to set the min/max for quantity of each product or the whole bundle but not for the "number of different products".

    If you want the buyer only can select 5 products from 14 different products, please use another plugin from us WPC Composite Products, add 5 components and 14 products for each component. You can see the demo composite with 3 components here https://demo.wpclever.net/wooco/product/composite-01/

    Best regards,
    Dustin

  • Damian Aramayo replied

    Hi Frankie,

    Thanks for your reply.

    In fact, I don't want an option to set min/max for quantity. I'd like to see a legend that says the number of products that I'm adding (before add to cart).

    This legend should be visible at any time.

    In the attachments you can see the legend that I mention (in purple). In these examples my legend should be:

    "You have selected 3 items",

    "You have selected 7 items"


    Depending on the number of items that the customers selected, the number in the legend should change.

    Is this possible?


    Thank you in advance.

  •  1,281
    Dustin replied

    Hi Damian,

    Thanks for the detailed information! Now I'm clear about this idea/requirementsmile.png

    Yes! I can help you change the code to do that when you use the premium version.

    If you already bought it, please provide the payment information, e.g Paypal Email or Paypal Transaction ID.

    Best regards,
    Dustin

  •   Damian Aramayo replied privately
  •  1,281
    Dustin replied

    Please add below code to current theme (or child-theme) / functions.php

    /* WPClever */
    add_action( 'wp_footer', 'woosb_footer', 99 );
    function woosb_footer() {
    ?>
        <script type="text/javascript">
          jQuery(document).on('woosb_save_ids', function(e, ids) {
            var woosb_selected_count = '';         if (ids.length) {
              if (ids.length == 1) {
                woosb_selected_count = '<div class="woosb_selected_count">You have selected 1 item</div>';
              } else {
                woosb_selected_count = '<div class="woosb_selected_count">You have selected ' + ids.length + ' items</div>';
              }
            } else {
              woosb_selected_count = '<div class="woosb_selected_count">You have selected 0 items</div>';
            }         if (jQuery('.woosb_selected_count').length) {
              jQuery('.woosb_selected_count').html(woosb_selected_count);
            } else {
              jQuery(woosb_selected_count).insertAfter('.woosb-products');
            }
          });
        </script>
    <?php
    }

    And the result https://prnt.sc/r5esds

    Best regards,
    Dustin

  •   Damian Aramayo replied privately
  •  1,281
    Dustin replied

    That means the total bundled products' quantitysmile.png

    Please use the new code:

    /* WPClever */
    add_action( 'wp_footer', 'woosb_footer', 99 );
    function woosb_footer() {
    ?>
        <script type="text/javascript">
            jQuery(document).on('woosb_save_ids', function (e, ids) {
                var woosb_selected_count = '';
                var woosb_count = 0;             if (ids.length) {
                    jQuery.each(ids, function (index, value) {
                        var value_arr = value.split('/');
                        woosb_count += parseInt(value_arr[1]);
                    });
                }             if (woosb_count == 0) {
                    woosb_selected_count = '<div class="woosb_selected_count">You have selected 0 items</div>';
                } else if (woosb_count == 1) {
                    woosb_selected_count = '<div class="woosb_selected_count">You have selected 1 item</div>';
                } else {
                    woosb_selected_count = '<div class="woosb_selected_count">You have selected ' + woosb_count + ' items</div>';
                }             if (jQuery('.woosb_selected_count').length) {
                    jQuery('.woosb_selected_count').html(woosb_selected_count);
                } else {
                    jQuery(woosb_selected_count).insertAfter('.woosb-products');
                }
            });
        </script>
    <?php
    }

    Best regards,
    Dustin

  • Damian Aramayo replied

    That worked perfect!

    Thank you very much for the support Frankie

  •  1,281
    Dustin replied

    You're welcome!smile.png
    Feel free to submit a new ticket if you have any questions when using our plugin. I'll close this ticket now.

    If you are satisfied with our plugin and support, please reward it a full five-star ★★★★★ rating. https://wordpress.org/support/plugin/woo-product-bundle/reviews?rate=5#new-post
    Thank you in advance! <3

    Best regards,
    Dustin