Home Forums WoodMart – Premium Template WooCommerce Tabs Closed by Default

This topic contains 11 replies, has 2 voices, and was last updated by gevcen gevcen 1 year, 5 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #124221
    gevcen
    gevcen
    Customer

    Dear,

    I’ve found a ticket from another user about closing the WooCommerce tabs by default. I tried to apply the code you’ve provided but it doesn’t work.

    setTimeout(function() {
        var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();
        $tabs.parent().find('#tab-description').hide();
        $tabs.parent().find( '.tab-title-description' ).removeClass('active');
    }, 10);

    Can you check please?
    Thanks

    Private Content Hidden
    • This topic was modified 1 year, 5 months ago by gevcen gevcen.
    • This topic was modified 1 year, 5 months ago by gevcen gevcen.
    #124245

    Hi,

    This code is for the description tab and your product page doesn’t have it at all.

    Regards

    #124268
    gevcen
    gevcen
    Customer

    Hi Artem,

    I’ve added description tab and the code doesn’t work neither. Can you check please?

    Also, how could the code be amended in such way that it also works when it’s the Review tab that is first (meaning when there are no “description tab”) ?

    Thanks

    #124269

    Try to increase the timeout 10 to 100, 500, or 1000.

    #124277
    gevcen
    gevcen
    Customer

    Artem,

    I tried the different timeout values. It works with 500 and 1000 but with a little issue. It still opens and re-closes it after the page load. https://gevcen.tinytake.com/tt/MzUzMjUxN18xMDYxODMyNw

    Can you check ?

    #124285

    Yes, it is how this supposed to work. It is a bit tricky but there are no other solutions for this task.

    #124313
    gevcen
    gevcen
    Customer

    Ok thanks. And how about my other question : how could the code be amended in such way that it also works when it’s the Review tab that is first (meaning when there are no “description tab”) ?

    Thanks

    #124325

    Try to change words description with reviews in that code.

    #124331
    gevcen
    gevcen
    Customer

    Yes it worked! For anyone interested :

    setTimeout(function() {
        var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();
        $tabs.parent().find('#tab-description').hide();
        $tabs.parent().find( '.tab-title-description' ).removeClass('active');
    }, 1000);
    
    setTimeout(function() {
        var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();
        $tabs.parent().find('#tab-reviews').hide();
        $tabs.parent().find( '.tab-title-reviews' ).removeClass('active');
    }, 1000);

    You can close the ticket, thanks

    #124499
    gevcen
    gevcen
    Customer

    Artem,

    Just one thing more, I’m trying to apply the same for the tab “Additional information” (table with attribute characteristics) but it’s not working.

    Can you help please?

    Private Content Hidden
    #124506
    gevcen
    gevcen
    Customer

    I managed it 🙂

    /**
     * Collapse the Description tab when it comes first in the accordion
     */
    setTimeout(function() {
        var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();
        $tabs.parent().find('#tab-description').hide();
        $tabs.parent().find( '.tab-title-description' ).removeClass('active');
    }, 1000);
    
    /**
     * Collapse the Reviews tab when it comes first in the accordion
     */
    setTimeout(function() {
        var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();
        $tabs.parent().find('#tab-reviews').hide();
        $tabs.parent().find( '.tab-title-reviews' ).removeClass('active');
    }, 1000);
    
    /**
     * Collapse the Additional Information tab when it comes first in the accordion
     */
    setTimeout(function() {
        var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();
        $tabs.parent().find('#tab-additional_information').hide();
        $tabs.parent().find( '.tab-title-additional_information' ).removeClass('active');
    }, 1000);
    #124638
    gevcen
    gevcen
    Customer

    You can close the ticket, thanks

Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘WooCommerce Tabs Closed by Default’ is closed to new replies.