How to Show the Short & Long Description in WooCommerce

Quick Summary

  • Print the short description by running the product's excerpt through the woocommerce_short_description filter, matching the default product page formatting.
  • A product_description shortcode registered in functions.php returns the long description with get_description(), without automatic paragraphs.
  • If the shortcode's id doesn't belong to a product, wc_get_product() returns false and the shortcode causes a fatal error.

WooCommerce products have two descriptions: the short description in the product summary and the long description in the Description tab. When you build a custom product template, these snippets let you print each of them wherever you need.

Short description

The short description is saved as the product’s excerpt. The snippet runs it through the woocommerce_short_description filter, so it gets the same formatting as on the default product page, such as paragraphs and shortcodes.

PHP
<?php $short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt ); ?>
<?php echo $short_description; ?>

This uses the global $post, so place it inside the product loop or on the single product template. Inside a function, declare global $post; first.

Long description with a shortcode

First, add this code to your child theme’s functions.php file. It registers a [product_description] shortcode.

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 $product->get_description();
}
  • The id attribute defaults to the current post’s ID.
  • If a global $product object already exists, as on a single product page, the shortcode uses it and ignores id. Otherwise it loads the product with wc_get_product().
  • get_description() returns the raw description, without the automatic paragraphs WordPress adds when it displays post content.

Then print the shortcode in your template with do_shortcode():

PHP
<?php echo do_shortcode( "[product_description]" ); ?>

You can also place [product_description id="123"] in page content, with 123 replaced by a product ID. Make sure the ID belongs to a product: if it doesn’t, wc_get_product() returns false and the shortcode causes a fatal error.

For product pages laid out around your descriptions and other content, see my WooCommerce development services.

Share on X (opens in a new tab) Share on LinkedIn (opens in a new tab) Share on Facebook (opens in a new tab)

ChatGPT (opens in a new tab) Claude (opens in a new tab) Gemini (opens in a new tab) Perplexity (opens in a new tab) Grok (opens in a new tab)

More Insights

See More