Especially when you migrate from a different ecommerce platform to WooCommerce, you may end up placing or importing content in the wrong place.
A lot of confusion, for example, arises when a new WooCommerce store owner needs to understand the difference between the “Long” and the “Short” description. Well, the “Long description” is the one that displays inside the “Description” tab, below the product summary (that section that features the image on the left + add to cart on the right), usually in full width. The “Short description“, on the other hand, is the one that shows on the right hand side of the product image, and is usually… shorter.
Now, what if you don’t use the “Short description” in your WooCommerce store, and you wish to display the “Long description” on the right hand side of the featured image instead? Well, here’s a simple snippet for you. Enjoy!
PHP Snippet: Show Long Description Instead of the Short Description @ Single Product Page
Note: to avoid duplicate content, you may also need to hide the “Description” tab of course, otherwise the Long Description will display twice once the snippet below is installed.
/**
* @snippet Long Instead of Short Description @ WooCommerce Single Product
* @how-to businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 8
* @community https://businessbloomer.com/club/
*/
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'bbloomer_template_single_long_description', 20 );
function bbloomer_template_single_long_description() {
strip_tags( the_content() );
}
This code.. doesnt read right.
the_content() immediatedly echos the content, strip_tags would be useless. Also, you should echo it, because its an action, not a filter.
Corrected code would probably be (untested):
Not really sure about your comment, this code works perfectly for me