WordPress.org

Forums

WooCommerce - excelling eCommerce
Rearrange Product Description and Related Products Tabs After 2.0 Upgrade (5 posts)

  1. WeddingAlbumCafe
    Member
    Posted 2 years ago #

    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/

  2. WeddingAlbumCafe
    Member
    Posted 2 years ago #

    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;
    }
  3. peyote
    Member
    Posted 2 years ago #

    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!

  4. WeddingAlbumCafe
    Member
    Posted 2 years ago #

    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;
    }
  5. lowcostego
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic