I need to hide the product description in the product page. But when the user clicks on the description tab I need to show the content. When the user clicks again, I need to hide the description. It needs to work like toogle.
But I can not complete this. Please help. For to hide description on page load I place the following script on single-product.php
$('.wc-tab').hide();
It is working. When page load it is hidden and user clicks it is show (description_tab active
) automatically.
But I need to show hide every click. Please help
This is HTML structure
<ul class="tabs wc-tabs">
<li class="description_tab active">
<a href="#tab-description">Description</a>
</li>
</ul>
Thank you .
Use the jQuery toggle function when you click the object that should show/hide the description.
The toggle function will show the element if it is currently hidden, or hide the element if it is currently shown.
You can hide the tab content on page load using Jquery and then you can show it when you click on tab title using Jquery.
// Remove Empty Tabs
add_filter( ‘woocommerce_product_tabs’, ‘yikes_woo_remove_empty_tabs’, 20, 1 );
Hereâs a function that will remove any empty tabs:
If you want to remove specific tabs, use the below function.