Support » Plugin: WooCommerce » [Plugin: WooCommerce – excelling eCommerce] How to change order of product tabs

Viewing 9 replies - 1 through 9 (of 9 total)
  • can anyone help at all? :-/

    Plugin Author Mike Jolley

    (@mikejolley)

    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 );

    Thanks Mike for sharing the fix!

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

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

    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

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

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

    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!

    incredibly great script! thanks so much!!!!

    Bob

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: WooCommerce – excelling eCommerce] How to change order of product tabs’ is closed to new replies.