Conditional Tabs
-
I have a store where I sell different types of products. I want different tabs (or no to tabs at all) to show depending on the product type (could be category or tag).
¿How can I do this?
-
The title of the Tab appears inside the content of the tab.
¿How can I disable this form happening?
Hi,
First question:
Unfortunately, there is no such support in the plugin to disable tabs or create different tabs based on category, however, you can do this by using the hookwoocommerce_product_tabs
provided by WooCommerce. You do have the ability to exclude/modify/add tabs using this hook.Second question:
No default option to hide tabs title inside tab content as it appears on every tab even WooCommerce core ones. But again, It can be adjusted using the above-mentioned hook.Thanks.
Hello:
What I meant is that the name of the standard Description WC tab is displayed only once on the tab name, not on the contents Inside the tab.
However if I add a global tab named Details, the name appears appears twice, once on the tab name and also again inside the tab contents.
Is this normal?
Don’t know how to send you a screenshot.
Hi @ivanpm
Is this normal?
Yes, it is. We are following the WC standard and so it does the same, display title under description.
To be specific, you said Description title shows only on the tab name but not in the contents, while this may be true for the theme you are using.
Can you name your active theme?However if I add a global tab named Details, the name appears twice, once on the tab name and also again inside the tab contents.
You can pretty much do anything to change the output of title/tab contents via the filter hook.
Quick solution to hide tab title in tab content for all tabs
add_filter('wptp_tab_object', function( $product_tab ) { unset( $product_tab->title ); return $product_tab; });
Note: Make sure you update the plugin to latest version (1.0.3). And this applies to the tabs that we manage.
Don’t know how to send you a screenshot.
Upload image to some free service like dropbox/google drive and share the link here.
Thanks
Thank you very much for being so responsive. Being somewhat of a novice I need to ask where to add this filter.
What PHP file? What part of the file?
I added it to wc-product-tabs-plus.php and it had no effect.
I say thanks in advance.
Welcome Ivanpm 🙂
You can add this filter to the filefunctions.php
of your active theme, you can find this file inside
/wp-content/themes/{your-active-theme}
Hello again:
My theme is Aurum.
I added the code to the functions.php and nothing happens.
Sorry to keep bugging you.
Maybe I should contact the Aurum developers.
Iván
Success!
I thought I had the latest version but did not.
How do I give you a 5 star review? Never done this.
Thanks again for your help.
I already posted my review.
Thanks.
- The topic ‘Conditional Tabs’ is closed to new replies.