Home Forums WoodMart support forum WooCommerce Tabs Closed by Default

WooCommerce Tabs Closed by Default

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

    Jeriss Cloud Center
    Participant

    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

    #124245

    Artem Temos
    Keymaster

    Hi,

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

    Regards

    #124268

    Jeriss Cloud Center
    Participant

    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

    Artem Temos
    Keymaster

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

    #124277

    Jeriss Cloud Center
    Participant

    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

    Artem Temos
    Keymaster

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

    #124313

    Jeriss Cloud Center
    Participant

    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

    Artem Temos
    Keymaster

    Try to change words description with reviews in that code.

    #124331

    Jeriss Cloud Center
    Participant

    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

    Jeriss Cloud Center
    Participant

    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?

    #124506

    Jeriss Cloud Center
    Participant

    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

    Jeriss Cloud Center
    Participant

    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.