How to Add Short Description in Woocommerce in place of Excerpt on product page ?

Woocommerce Product Short Description

Most of people find difficulty in removing Excerpt and adding Short Description on the product pages as the short description formatting is allowed via editor but, Except is auto truncated kind of sentence so, it is some time not good for most woocommerce websites to display Except when you want to present something attractive on start of page.

Here will explain you how you an achieve it just by adding few lines of code and making use of Short Code on product page by using Editor.

In the below screen you can see Short Description Section:

Woocommerce

How to add the code in function.php file ?

Now, what you have to do is open function.php file of your current theme add the below code:

Woocommerce
/**
*
* Get Product Short Description by PurchaseTheme
*/
function dispaly_product_short_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_short_description();
}
add_shortcode( 'product_short_description', 'dispaly_product_short_description' );

Now, showing the screenshot of removing Excerpt and adding the short code:

Woocommerce

Leave a Reply

Your email address will not be published. Required fields are marked *