Support » Plugin: WooCommerce » Adding new tabs and disabling default ones

  • Resolved mompracem


    I need to add two new tabs to my products and remove the default tabs.

    For the latter problem I’m using Tab Manager extension.

    To add new tabs I’m using the following the following snipped with WooCommerce 2.02:

    function sg_woocommerce_map_tab() { 
        echo '<li><a href="#tab-new">' . __( 'My tab label', 'mytextdomain' ) . '</a></li>'; 
    add_action( 'woocommerce_product_tabs', 'sg_woocommerce_map_tab', 40 );
    function sg_woocommerce_map_panel() { 
        require_once TEMPLATEPATH . 'parts/map.php';
        // I've tried also with include or commenting out the above line or using other code, no change in my issue
    add_action( 'woocommerce_product_tab_panels', 'sg_woocommerce_map_panel', 40 );

    My issue is that, using the code above I get an infinite loop for the tab I’m trying to add on the product page. On the Tab Manager admin page (the third one, to select default tabs) I get a 404.

    Tried to contact WooCommerce support but after 13 days I’m still stuck.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Roy Ho


    2.0 uses filters to add/remove tabs not action. Please look through the first 5 pages of the support here, the correct method is listed.

    oh thanks eventually an answer of yours from this thread resolved it brilliantly

    I should have come up here rather than searching in WooCommerce support, my silly mistake to ignore WordPress forums as first choice to gather information…

    what I’m trying to understand now, is how to make one of the tabs I want to pass in the array conditional?

    eg suppose I have one tab which should appear only if the product (post) has a certain condition (such as a meta or other), how would you do that?

    I need to pass more than one tab.


    Roy Ho


    Then you would probably need to retrieve the meta from the post so that it can be checked against.

    So I would imagine you need to pull in the global $post variable so you can find out which product you’re on. And from the variable, you can use its methods to pull the meta information.

    oh in the meanwhile I figured out myself

    instead of placing the conditional inside the filter, I did inside tabs.php… essentially I put a conditional based on the $key in the foreach loop for tab and panel, works

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding new tabs and disabling default ones’ is closed to new replies.