• Resolved Mathesonandrew

    (@mathesonandrew)


    Since we’ve been upgraded the custom tabs features don’t work, i can’t add or remove tabs like i used to, here’s the code i was using called from my functions.php

    remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30);
    remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30);
    
    add_action( 'woocommerce_product_tabs', 'sb_woocommerce_new_tab', 40 );
    add_action( 'woocommerce_product_tab_panels', 'sb_woocommerce_new_panel', 40 );
    function sb_woocommerce_new_tab() {
     echo '<li><a href="#assesment-assignment">' . __('Assessment & Assignment', 'woocommerce') . '</a></li>';
     echo '<li><a href="#examination-accreditation">' . __('Examination & Accreditation', 'woocommerce') . '</a></li>';
     echo '<li><a href="#reviews">' . __('Comments & Reviews', 'woocommerce') . '</a></li>';
    
    }
    function sb_woocommerce_new_panel() {
     echo '<div class="panel" id="assesment-assignment">
     <h2>New Panel 1</h2>
     <p>Example content...</p>
     </div>
     <div class="panel" id="examination-accreditation">
     <h2>New Panel 2</h2>
     <p>Example content...</p>
     </div>
     <div class="panel" id="reviews">
     <h2>New Panel 3</h2>
     <p>Example content...</p>
     </div>';
    }

    https://www.ads-software.com/extend/plugins/woocommerce/

Viewing 4 replies - 16 through 19 (of 19 total)
  • vtex

    (@endriuska)

    Mathesonandrew – looks great, can you share how you created those tabs? I know a little bit of coding, but not enough to understand from the conversation above. Can you point me the right direction? I’m looking for the below:

    1) where do I add(what file) the code above? so the tab shows up?
    2) how do I specify tab informaiton(what’s inside tab) for each product?

    Thanks in advance

    dalemoore

    (@dalemoore)

    How do you just remove tabs entirely, without adding them, but keep the product attributes panel itself? It is the only thing I am using, and I have no need for tabs to switch between other things since I am not using reviews or anything else. I want all of that gone, leaving only the image, thumbnails, and product attributes.

    I had this all set up perfectly with actions… but now all of these tabs are showing that I didn’t want. I don’t use the tabs at all, I was outputting what was in the panel elsewhere.

    mompracem

    (@mompracem)

    @endriuska the snippet posted by splashing pixels works just fine, you only have to replace values in the $my_tab array with your own – you can add multiple tabs in such way – the callback is a function which you’ll use to build content for your tab

    now I’m trying to figure out how to make one tab conditional

    Hi @mathesonandrew I′m trying to add a map tab, I put your code and got a error:

    Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in in the tabs.php file

    Do you know what filter o function is missing, did you achieve to do it?

    Thanks!

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Adding custom product tabs to 2.01’ is closed to new replies.