WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] How to rearrange tabs viewed with Woocommerce (8 posts)

  1. agruenke
    Member
    Posted 1 year ago #

    I have Woocommerce 2.0.2 installed. I was wondering how do i change the default tab view on a product page? right now it always shows the description first. I want to be able to select the Additional Information tab to be viewed first.

    how do i change this setting? I cant find any selection for this anywhere.

    Any help would be appreciated.

    Thanks

    http://wordpress.org/extend/plugins/woocommerce/

  2. WeddingAlbumCafe
    Member
    Posted 1 year ago #

    I used this filter to list my decription first. you can change the priorities so that your desired tab is firlst.

    add_filter( 'woocommerce_product_tabs', 'sb_woo_move_description_tab', 98);
    function sb_woo_move_description_tab($tabs) {
    
    $tabs['description']['priority'] = 5;
    $tabs['related']['priority'] = 10;
    $tabs['reviews']['priority'] = 20;
    
    return $tabs;
    }
  3. agruenke
    Member
    Posted 1 year ago #

    thanks for your information, i am sorry i am new at editing PHP files. Can you please eleborate....what file do i put those lines of code in and where do i find it?

    your assistance is appreciated

    Thanks

  4. WeddingAlbumCafe
    Member
    Posted 1 year ago #

    wp-content/themes/yourtheme/functions.php

    add the code like so after the bit of text that tells you where to add custom functions.

    /*-----------------------------------------------------------------------------------*/
    /* End Theme Load Functions - You can add custom functions below */
    /*-----------------------------------------------------------------------------------*/
    add_filter( 'woocommerce_product_tabs', 'sb_woo_move_description_tab', 98);
    function sb_woo_move_description_tab($tabs) {
    
    $tabs['description']['priority'] = 5;
    $tabs['related']['priority'] = 10;
    $tabs['reviews']['priority'] = 20;
    
    return $tabs;
    }
  5. agruenke
    Member
    Posted 1 year ago #

    Finally got it working, I had to tweak a few settings to get the additional information to show up first in front of Description...

    here is what i had to put

    add_filter( 'woocommerce_product_tabs', 'sb_woo_move_description_tab', 98);
    function sb_woo_move_description_tab($tabs) {

    $tabs['description']['priority'] = 10;
    $tabs['additional_information']['priority'] = 5;
    $tabs['reviews']['priority'] = 20;

    return $tabs;
    }

    Thanks for your Help

    works like a charm

  6. woodsandhillsplc
    Member
    Posted 1 year ago #

    Thanks WeddingAlbumCafe, the code worked perfectly for me :)
    Saved me a lot of time!
    Colin

  7. hpwtexas
    Member
    Posted 1 year ago #

    Note: If you have product reviews/comments disabled, the review tab will still be generated, without a label or content, which will look kinda wonky. I removed the line:

    $tabs['reviews']['priority'] = 20;

    Thanks WeddingAlbumCafe, been looking for this!

  8. sukandia
    Member
    Posted 10 months ago #

    nice, you can find documentation customization of woo commerce tab at http://docs.woothemes.com/document/editing-product-data-tabs/

    but if you have an empty tab's content, your tab will generated tab without label and content. you can tweak it by yourself.
    i.e:

    if ( ! empty ( $tabs['description'] ) ) {
    $tabs['description']['priority'] = 25; // Description second
    }

    thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic