WordPress.org

Support

Support » Plugins and Hacks » Rearrange Product Description and Related Products Tabs After 2.0 Upgrade

Rearrange Product Description and Related Products Tabs After 2.0 Upgrade

  • I would like my Product Description Tab to be the default tab on the Product Page. Before upgrading to 2.0 I was able to accomplish this by adding this simple hook to functions.php

    remove_action( 'woocommerce_product_tabs', 'yiw_related_products_tab', 1 );
    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 ); 
    
    add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
    add_action( 'woocommerce_product_tabs', 'yiw_related_products_tab', 15 );
    add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
    add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );

    Now actions no longer work and I need to apply a filter to achieve this. I am a complete novice with no knowledge of how to create a filter. I’ve read various posts here on the forum trying to accomplish my goal but I have not had any luck.

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sorted. If anyone is interested here’s how

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

    Hi!

    Thanks for the post! I’m also very new to this and was hoping you could assist me please – which file / location do I edit with the above code?

    I have read all about filters and hooks in WP and trying to get my head around it. But not sure which file/s in WooCommerce one should edit?

    Many thanks!

    yourtheme/functions.php

    just add to the bottom of your file like so

    /*-----------------------------------------------------------------------------------*/
    /* 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;
    }

    I just want to say thank you!!! I just finally rearranged my product tabs, I have searched high and low.

    The keyword I used in google was “how to rearrange product tabs in woocommerce” I hope this helps someone else.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Rearrange Product Description and Related Products Tabs After 2.0 Upgrade’ is closed to new replies.