More small and impactful customizations in WooCommerce. In this article, I am using PHP code snippets to (temporarily) remove the product short description from displaying on the single product page. Firstly, for all products. Then we will filter for a specific product only, which may simulate a more real-world use case.
The Newsletter for PHP and MySQL Developers
Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.

WooCommerce Product Short Description
For most all products, there is typically a “short product description” having a brief wording or phrase above the Quantity field and Add to cart button on the Single Product page in WooCommerce.
There are many ways to remove this short description. However, in this example, I am using some custom PHP code.
Note: All custom PHP code is placed in the child theme’s (the default Storefront theme with minimal customization in this case) functions.php file in a development/testing environment.
Using the woocommerce_single_product_summary hook
The woocommerce_single_product_summary hook is responsible for displaying the product’s short description so you can target it with your own callback function using the add_action() function.
add_action( 'woocommerce_single_product_summary', 'wc_remove_single_product_short_description', 12 );
function wc_remove_single_product_short_description()
{
global $post;
if ( ! empty( $post->post_excerpt ) )
{
$post->post_excerpt = '';
echo $post->post_excerpt;
}
}
In the PHP code above, I am essentially testing with the if() conditional, verifying if the $post object’s post_excerpt property has (any) data and if so, reassigning it to an empty string (”) and echoing it back to the frontend.
As shown in the screenshot below, the product short description is no longer displayed for the ‘Beanie with Logo’ product.
(Based on my knowledge, this is only a temporary fix (if that) as the actual product short description is still stored in the MySQL or MariaDB database.)
Target a specific product’s short description
While the previous approach does work, it affects – and hides – all product’s short descriptions. And that might not be the goal or overall best practice.
If that’s the case, you can target a specific product using a product’s ID property value with the get_id() function.
add_action( 'woocommerce_single_product_summary', 'wc_remove_single_product_short_description', 12 );
function wc_remove_single_product_short_description()
{
global $post;
global $product;
if ( ! empty( $post->post_excerpt ) && 33 == $product->get_id() )
{
$post->post_excerpt = '';
echo $post->post_excerpt;
}
}
Using this updated PHP code, an altogether different product (the Belt product in this case) retains its product short description because of the additional filter in the if() conditional for the product ID of 33 (which is that of the Beanie with Logo product).
Credit Source
I was only able to learn these concepts and apply them after reading and studying this fantastic article: https://www.businessbloomer.com/woocommerce-show-custom-short-description-when-empty/
Thank you for reading this post. Please share it with someone else who would enjoy it as well.
Josh Otwell has a passion to grow as a PHP Developer, SQL expert, and technical blogger/writer.
Disclaimer: The majority of examples in this post, are performed in a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Like always, just because you can do something doesn’t mean you should. My opinions are my own.
More ways I can help
- Need hosting for your next web application or WordPress site? I highly recommend Hostinger and use them to host my niche bass fishing site. The service is second to none.
- 🔒5 Truths I’ve Come To Realize As a Self-taught Developer
- Desktop and mobile wallpapers, digital downloads, photography services, Shopify and WooCommerce customizations, and content writing – all in one E-commerce Shop. Find your next digital purchase today!
Disclosure: Some of this blog post’s services and product links are affiliate links. At no additional cost to you, should you make a purchase by clicking through one of them, I will receive a commission.
The Newsletter for PHP and MySQL Developers
Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.
📰 Get your brand, product, or service the attention it deserves with affordable classified ad placement in the OpenLampTech newsletter. I appreciate your support!