• Hello,

    I needed a ? All product ? button as a tab.

    I did it like this :

    $product_categories = get_terms('product_cat', $args); ?>
                        <ul>
                            <li><a id="all" class="all-product" data-name="All" href="#">All products</a></li> <!-- HERE MY BUTTON -->
                            <?php
                            $i = 0;
                            foreach ($product_categories as $cat) {
                                ?>
                                <li><a id="<?php echo $cat->slug; ?>"

    JS

    jQuery(document).ready(function () {
    
    ...
    
    //<a id="all" class="all-product" data-name="All" href="#">All</a> 
    
    jQuery("#wtcpl_tabs a.all-product").click(function (event) {
            if (jQuery(window).height() <= 767) {
                jQuery.scrollTo('.product_content', 1000);
            }
            event.preventDefault();
            var my_id = jQuery(this).attr("id");
                console.log('my id'+my_id);
    
            jQuery("#wtcpl_tabs a").removeClass("active");
            jQuery(this).addClass("active");
    
            jQuery("#wtcpl_tabs_container .each_cat").fadeOut(0);
            jQuery("#wtcpl_tabs_container .each_cat").removeClass("active");
    
            jQuery(".each_cat").fadeIn();
            jQuery("#wtcpl_tabs a.all-product").addClass("active");
    
        });
        
    });

    Can you also doing it for your next update ?

  • The topic ‘Adding an “All products” button’ is closed to new replies.