How To Display Long Descriptions Instead Of Short Ones on Single Product Pages | WooCommerce
Do you want to display long descriptions on a single product page at the WooCommerce store?
When setting up your WooCommerce store, understanding the nuances of product descriptions is crucial. One common challenge is distinguishing between the “Long” and “Short” descriptions and determining where each should be displayed.
This guide will walk you through a simple process to showcase the long description on the right side of the featured image on your single product pages.
Why is it Important to Display Long Descriptions?
Before we delve into the process, let’s briefly understand why you might prefer showcasing long descriptions prominently:
- Comprehensive Information: Long descriptions provide more detailed information about your products, helping customers make informed decisions.
- Visual Appeal: Displaying a longer description on the right side of the product image can create a visually pleasing layout, especially for products with extensive details.
Now, let’s proceed with the step-by-step guide.
Display Long Descriptions Instead Of Short Ones on Single Product Pages
In WooCommerce, the Long description typically appears within the Description tab below the product summary. On the other hand, the Short description is usually displayed on the right side of the product image and is shorter.
How to Add Shipping Rate Description At Cart & Checkout Page?
If you’ve decided not to use the “Short description” and want to replace it with the “Long description,” you can use a simple PHP snippet. Open your theme’s functions.php
file or use a child theme, and insert the following code:
Step 1: Log in to your WordPress dashboard. Navigate to “Appearance” and select “Theme Editor.“
Step 2: Locate and open the functions.php
file. Alternatively, use a child theme if you have one.
Step 3: Copy and paste the following PHP snippet at the end of your functions.php
file:
/*
Description: Long Instead of Short Description @ WooCommerce Single Product
Author: Mudassar Shakeel
Websites:https://mcstarters.com/
*/
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() );
}
Step 4: Click the “Update File” button to save the changes made to the functions.php
file.
Before applying these changes to your live site, it’s crucial to test them in a staging environment. Temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and check if the snippet works as expected.
This will help identify and resolve any conflicts that may arise during the implementation process.
Conclusion:
By following these steps, you can seamlessly replace short descriptions with long ones on your WooCommerce single product page. This customization not only enhances the visual appeal of your product pages but also ensures that your customers receive comprehensive information about your products.
FAQs
Why would I want to display long description
instead of short ones on my WooCommerce product pages?
Displaying long descriptions provides more detailed information about your products, helping customers make informed purchase decisions. It allows you to showcase extensive product details prominently.