The WooCommerce product short description is that piece of content that appears on the right hand side of the featured image above the add to cart button. This is, of course, unless you forgot to enter the short description under Product > Edit Product > Short Description!
In case you forgot to enter it or you want to display a global short description, here’s a quick PHP snippet for you. Enjoy!
PHP Snippet: Display Custom Short Description When Empty @ WooCommerce Single Product Page
/**
* @snippet Show Global Short Description If Empty - WooCommerce
* @how-to businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 6
* @community https://businessbloomer.com/club/
*/
add_action( 'woocommerce_single_product_summary', 'bbloomer_echo_short_desc_if_empty', 21 );
function bbloomer_echo_short_desc_if_empty() {
global $post;
if ( empty ( $post->post_excerpt ) ) {
$global_excerpt = '<p class="default-short-desc">';
$global_excerpt .= 'This is the default, global, short description.<br>It will show if <b>no short description has been entered!</b>';
$global_excerpt .= '</p>';
echo $global_excerpt;
}
}
Is it possible to add a shortcode in place of ‘This is the default, global, short description.It will show if no short description has been entered!‘; ? I would like to add the shortcode [specs-table]. Thanks in advance
Sure, check the WordPress function do_shortcode()
Show can i show the product description instead of the custom text?
This should help https://businessbloomer.com/woocommerce-remove-product-tabs-echo-long-description/
How can we do this but for the product description itself not the product short description ?
Hi Maged, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Thank you for your post. How can I add the “Short Description” by specific tags? Or insert the main descriptions to the short descriptions?
Hi Steve, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
When we force the short description it is not picked up by the woocommerce schema any ideas how we can all fix this? Schema has become a big thing lately with Google. 🙂
Hello Nexus, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R
Hi,
This snippet works great for Single posts where it displays only once, however for variable products when a variation is selected it displays twice.
I can hide the second custom short description by using css, but was wondering if there is a way to hide is programmatically.
Thanks
You’re right – snippet updated!
That’s a really good idea. Something to enhance it just a little more would be to pull a short description from an associated tag or category, therefore if there is nothing in the product description for that item, it can pull a generic one for whatever is in that category, whether it be “boys shorts”, “men’s watches”, “pizzas”, “flooring”, etc.
Nice idea! Thank you Madivad 🙂
Another amazing snippet!
Thank you 🙂