Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

657
Visualizações
WooCommerce how to hide "Description" tab if product description is empty

I want to hide the "Description" heading of the WooCommerce product whenever the product's long description field is empty.

enter image description here

I've tried this:

// Remove Empty Tabs
add_filter( 'woocommerce_product_tabs', 'yikes_woo_remove_empty_tabs', 20, 1 );

function yikes_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;
}

But that doesn't end up hiding the heading. This heading doesn't appear to be an actual tab.

It looks like this in the rendered source:

<div class="product-description">
    <h3 class="summary-description-title">Description</h3>
</div>
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

That is a "tab" created by woocommerce. So you could check whether it has content or not, if not, then you could unset it. Like this:

add_filter('woocommerce_product_tabs', 'your_them_manipulating_description_tab', 99);

function your_them_manipulating_description_tab($tabs)
{
  global $product;

  $product_description = $product->get_description();

  if (!$product_description) 
  {
    unset($tabs['description']);
  }
  return $tabs;
}

It works on my end, let me know if you could get it to work too!

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda