Search the site:

How to add text below the short description of the Product in WooCommerce

WooCommerce lets us write a short description for every product that we add to our store, which appears alongside the product image as illustrated in the image below:

How to add text below the short description of the Product in WooCommerce - Default Short Description

 

This “short description” can be updated anytime that you wish to add some text to it.

However, sometimes, it may so happen that you want to have a site-wide or a store-wide sale, or display an important notification such as that of exclusion of taxes in the price, shipping costs, free shipping above a certain price or of stocks selling fast. In all these cases, it is not feasible to add text to the short description field of every product. In this post, you will learn how to add text below the short description of the product in WooCommerce through code snippets, such that this text gets added to all products in the store.

Add the code snippet below to the functions.php file of your child theme, and assign any text that you wish to display to the variable $text :

add_filter('woocommerce_short_description','ts_add_text_short_descr');
function ts_add_text_short_descr($description){
  $text="Offer: 40% OFF at Checkout on all products across the store.";
  return $description.$text;
}

(To know why we edit the functions.php of the child theme and not directly the functions.php file, read this post.)

Here, woocommerce_short_description is a Woocommerce filter associated with the short description of a product to which we are adding a hook/function called as “ts_add_text_short_descr”. The function returns the short description of the product along with the added text. This added text is added to the short description of every product in the store:

How to add text below the short description of the Product in WooCommerce - Added text to short description example1

How to add text below the short description of the Product in WooCommerce - Added text to short description example2

 

You can even add HTML tags to the text to format it. For example,

add_filter('woocommerce_short_description','ts_add_text_short_descr');
function ts_add_text_short_descr($description){
  $text="<b>Offer:</b> 40% OFF at Checkout on all products across the store.<br/><br/>";
  return $description.$text;
}

Modifying the earlier code snippet to the one above will format the added text according to the HTML tags mentioned in the string assigned to the variable $text.

How to add text below the short description of the Product in WooCommerce - Formatted the added short description text.

In this way, you can add any text below the short description of products in WooCommerce.

Adding content (be it HTML, text or images) above the short description can also be done using code snippets, in various ways as shown in this post.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

3 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Vivek Nath R
Vivek Nath R
1 year ago

Hi,

How can I add a dynamic text after short description? which means for every single product different texts.

Robert
Robert
1 year ago

That doesn’t work!!!

Jeff
Jeff
11 months ago

Would there be a way to do this, but also to apply it only to certain categories or products? Ex: I want a disclaimer text I want to appear on all products under my “exclusive” category. Based on the snippet in the original article, is there a way to modify it to show only on products under that “exclusive” category?

from purchased

Subscribe for more offers

3
0
Would love your thoughts, please comment.x
()
x