How do I get the description from a woocommerce product?

Im building a short code to display product info when passed with an ID, Ive got the title and image working but the description is the one Im having trouble with.

function wcproductslider($atts) {
$a = shortcode_atts( array(
    'product' => '98',
), $atts );

$product_ID = $a['product'];
$pro = new WC_Product($product_ID);

$ret = "<b>Title: </b>".$pro->get_title() . "<br>";

$ret .= "<b>Image: </b><br> <a href=' " .$pro->get_permalink() . " '>".$pro->get_image($size = 'shop_thumbnail') . "</a><br>"; 

$ret .= "<b>Long Description: </b>" . $pro->post->post_content;
$ret .= "<b>Short description: </b>" . $pro->post->post_excerpt;
return $ret;

}

I managed to figure some of it out using wc product class but theres nothing about the product excerpt.

Read More

Any ideas would be greatly appreciated.

Related posts

Leave a Reply

1 comment

  1. Figured it out, didn’t put anything in my short description of the product.

    Long Description

    $pro->post->post_content;
    

    Short Description

    $pro->post->post_excerpt;