not display tab description when empty

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 2 reply threads
  • Author
    Posts
    • #125587

      Hello,

      Sometimes, the vendor fill in only the short description but not the description.
      When the description is empty, the tab is displayed without the title of the tab.

      I would like to not display the tab at all when the description is empty.
      Is it possible ?

      Attached, a screeshot of the tab when the description is filled in, and a screenshot when the description is empty.

      Thanks
      Aurélien

      Attachments:
      You must be logged in to view attached files.
    • #126193

      Hello,

      Try this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      // Remove Empty Tabs
      add_filter( 'woocommerce_product_tabs', 'wcfm_woo_remove_empty_tabs', 20, 1 );
      
      function wcfm_woo_remove_empty_tabs( $tabs ) {
      
      	if ( ! empty( $tabs ) ) {
      		foreach ( $tabs as $title => $tab ) {
      			if ( empty( $tab['content'] ) && strtolower( $tab['title'] ) !== 'description' ) {
      				unset( $tabs[ $title ] );
      			}
      		}
      	}
      	return $tabs;
      }

      Thanks.

    • #126203

      Hello Sarmistha Chakraborty,

      Thank you for your return !
      It doesn’t work.
      The display of the description tab with this snippets is always empty even if there is a text inside.
      The title of the tab is also empty.
      cf. screenshot. Normally, there is a text inside the description tab on this product.

      Aurélien.

      Attachments:
      You must be logged in to view attached files.
      • #126429

        Hi,

        Please check once this description tab, to activate WordPress default theme.

        Thanks.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.