Home / WooCommerce / Adding a product short description to product archives in WooCommerce

Adding a product short description to product archives in WooCommerce

Published On: February 10th, 2020|Categories: WooCommerce|Tags: , |2 min read|

Today I’ll show you how to add a product short description in product category (archive) pages in WooCommerce. By default, the product card only show product image, name, price and add to cart button. It is really useful for the customers when browsing to see that short description when selecting a product.

woocommerce add product description to archive

PHP Snippet: Add product short description to product category in WooCommerce

Displaying the product short description in the product archive pages is fairly simple. We’ll use the woocommerce_after_shop_loop_item_title action hook. Just place the code below in your child theme’s functions.php file.

function webroom_add_short_description_in_product_categories() {
	global $product;
	if ( ! $product->get_short_description() ) return;
	?>
	<div itemprop="description">
		<?php echo apply_filters( 'woocommerce_short_description', $product->get_short_description() ) ?>
	</div>
	<?php
}
add_action('woocommerce_after_shop_loop_item_title', 'webroom_add_short_description_in_product_categories', 5);

The above code will display the short description right between the name and the price of the product. If you like to display the description below the price, you’ll have to change the action hook to woocommerce_after_shop_loop_item.

add_action('woocommerce_after_shop_loop_item', 'webroom_add_short_description_in_product_categories', 5);

How to add product short description in WooCommerce

The short product description won’t show in the category pages unless you actually add it to the product itself. Go ahead and edit a product. Right below the Product data options, you’ll see the Product short description field. This is the field you have to fill in order to show the short description.

You should be able to now add product description and view it in a WooCommerce products archive.

Learn more about the action hook we used woocommerce_after_shop_loop_item_title here.




Related Articles

If you enjoyed reading this, then please explore our other articles below:

More Articles

If you enjoyed reading this, then please explore our other articles below: