How to hide the Variations description in WooCommerce without harming your Catalog

Hide the description of variations in WooCommerce and keep it in the Facebook catalog with a simple adjustment to the code.

If you use WooCommerce and want to hide the description of the variations only on your site, but keep them in the Facebook catalog, here’s a quick solution!

🔧 Step-by-step:

  1. Go to the WordPress dashboard.
  2. Go to appearance > Theme Editor (preferencialmente no tema filho).
  3. Open the file functions.php e cole o código abaixo:
add_filter('woocommerce_product_variation_get_description', 'esconder_descricao_variacao_no_site', 10, 2);

function esconder_descricao_variacao_no_site($descricao, $produto) {
    if (is_product()) {
        return ''; // Esconde a descrição da variação apenas na página do produto
    }

    return $descricao;
}

What the code does:
Hides the description of variations only on the product pages of your site. In the Facebook or Google Merchant Center data feed, the description is still available.

Simple, quick and easy.

See you next time!

Anúncio
Categorias

Leave a Comment