WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] How to change order of product tabs (10 posts)

  1. rwilson86
    Member
    Posted 1 year ago #

    Hi I've tried editing nearly every file in my woocommerce folder but just can't figure out what code I need to change to change the order my product tabs are displayed :-/

    If you look at http://www.vsion.co.uk/rw/?product=jung-reach - You can see the fist tab with the product title in it, then the second tab with my product attributes. How do I swap these so that the tab with my product attribute displays first?

    Many thanks in advance :-)

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

  2. rwilson86
    Member
    Posted 1 year ago #

    can anyone help at all? :-/

  3. mikejolley
    Member
    Plugin Author

    Posted 1 year ago #

  4. Pete White
    Member
    Posted 1 year ago #

    Does anyone know the code to re-order the related products tab?

    So far, I'm using the following code which I obtained from the github link and have tried to add related_tab and related_products_tab with no luck.

    /**
     * Reordering the tabs
     * First they must be removed and then added again in the order you would like by changing the priority
     * If you use the WooCommerce Custom Product Tabs Lite plugin that has a priority of 25
     *
     * Add the following to you theme functions file
     * This code will allow the Tab Manager tab to be first, then attributes, the description, then reviews
     */
    	remove_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
    	remove_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
    	remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
    
    	remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
    	remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20 );
    	remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 );
    
    	/* Product page tabs */
    	add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
    	add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
    	add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
    
    	add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
    	add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20 );
    	add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 );
  5. Bozz
    Member
    Posted 1 year ago #

    Thanks Mike for sharing the fix!

    Pete, my related products are listed below my tabbed info area. I don't see it tabbed.

  6. Bozz
    Member
    Posted 1 year ago #

    Actually there is an error in Mike's code. replace remove_action with add_action in the last 3 lines of code.

  7. rwilki
    Member
    Posted 1 year ago #

    awesome! the code without the <?php> tags is missing a close } and like Bozz said, needs "add_action" rather than "remove_action" at the bottom.

    Thanks again!
    Bob

  8. leanderbraunschweig
    Member
    Posted 1 year ago #

    Doesn't work for me, breaks the page :-/

    Are there any new hooks / filters introduced with the new WooCommerce version?

  9. leanderbraunschweig
    Member
    Posted 1 year ago #

    Found it - this code works perfectly:

    add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
    function woo_reorder_tabs( $tabs ) {
    
    $tabs['additional_information']['priority'] = 5; // Additional information first
    $tabs['description']['priority'] = 10; // Description second
    $tabs['reviews']['priority'] = 15; // Reviews last
    
    return $tabs;
    }

    More on editing product data tabs in the official WooCommerce documentation: http://docs.woothemes.com/document/editing-product-data-tabs/

    Cheers!

  10. rwilki
    Member
    Posted 11 months ago #

    incredibly great script! thanks so much!!!!

    Bob

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic