1. Home
  2. Knowledge Base
  3. WooCommerce Product Tabs
  4. Advanced Usage

How to display the WooCommerce product description in a custom tab

If you are using WooCommerce Product Tabs to customize your product pages, you may want to automatically display the main product description in a custom tab, without manually copying and pasting text for every single product.

By default, WooCommerce does not include a native [product_description] shortcode. If you try entering [product_description] into a tab content area, it will simply render as plain text or remain blank.

To solve this, you can create a custom shortcode using a simple PHP snippet.

Step 1: Add the shortcode code snippet

To register the custom [product_description] shortcode on your site, add the following snippet to your theme using a dedicated code snippets plugin (such as Code Snippets or WPCode):

<?php
add_shortcode( 'product_description', 'display_product_description' );
function display_product_description( $atts ){
    $atts = shortcode_atts( array(
        'id' => get_the_id(),
    ), $atts, 'product_description' );

    global $product;

    if ( ! is_a( $product, 'WC_Product') )
        $product = wc_get_product($atts['id']);

    return apply_filters( 'the_content', $product->get_description() );
}

Note: If you are unsure how to add custom code snippets to your WordPress site safely, please follow our guide.

Step 2: Display the description in your product tab

Once you have added and activated the snippet:

  1. Go to your WooCommerce Product Tabs settings (or open a specific product tab's editor).
  2. Insert [product_description] into the tab content area.
  3. Save your changes.

The custom shortcode will now dynamically fetch and display the product's main description inside your new tab automatically for every product.

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.