How To Show Short & Long Description In Woocommerce

Share Now

#FOR SHORT DESCRIPTION

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

#FOR LONG DESCRIPTION
1. Add this code in function.php file

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();
}

2. Now echo the short code

<?php echo do_shortcode( "[product_description]" ); ?>
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert