Skip to content
Mc Starters Main Logo Circle
  • Home
  • CompanyExpand
    • About Us
    • Meet with Team
    • Media Assets
    • We’re Hiring
    • Contact Us
  • Top CategoriesExpand
    • WooCommerce
    • Elementor
    • Webflow
    • Divi
    • WordPress
    • SEO
    • Payoneer Guides
    • Shopify Tutorials
    • Squarespace
    • Weebly
    • Wix
    • Website Builders
    • CRM
    • Payment
  • Tips and TricksExpand
    • AI
    • Business
    • Insurance
    • Resources
    • Review
    • Science and Technology
    • Windows 10
    • Windows 11
  • ServicesExpand
    • WordPress Web Design
    • Elementor Expert
    • Divi Theme Experts
    • Blog Setup
    • WordPress Customization
    • E-Commerce Websites
    • Crocoblock Expert
    • Hire Webflow Expert
  • Free TemplatesExpand
    • Elementor Templates
    • Elementor Header
    • Elementor Footer
    • Elementor Single Post Templates
    • Elementor Mega Menu
    • Divi Templates
    • Divi Header Layouts
    • Divi Footer Layout
  • Tools
  • Guest Posts

Lifetime Pro Access to Elementor & Divi Templates

Grab deal
Mc Starters Main Logo Circle
Home / WooCommerce / How To Truncate Short Description With “Read More” Toggle in WooCommerce?

How To Truncate Short Description With “Read More” Toggle in WooCommerce?

Published By :Iram S. March 5, 2024March 5, 2024 WooCommerce
How To Truncate Short Description With “Read More” Toggle in WooCommerce

How to Truncate Short Description With “Read More” Toggle in WooCommerce?

Providing an engaging and streamlined shopping experience is crucial for customer satisfaction. WooCommerce, the popular WordPress e-commerce plugin, offers a plethora of customization options.

Display Long Descriptions Instead Of Short Ones on Single Product Pages

In this blog post, we’ll explore a simple yet effective technique to truncate the short description of your products and incorporate a “Read More” toggle, ensuring a cleaner and more user-friendly product page.

Why Truncate?

When it comes to showcasing product information, brevity is often key. A concise product description provides a quick overview, enticing potential buyers to explore further. However, for those instances where additional details are necessary, a “Read More” option comes in handy, striking a balance between informativeness and a clutter-free interface.

Truncate Short Description With “Read More” Toggle in WooCommerce

Truncate short description in WooCommerce with ease using a ‘Read More’ toggle. Enhance user experience and maintain a clean product page. Follow our step-by-step guide for seamless customization.

Step 1: Log in to your WordPress admin panel. Go to “Appearance” -> “Theme Editor.“

Step 2: Locate and select the “Theme Functions” file or functions.php your child theme.

Step 3: Copy the provided PHP code and paste it at the end of the selected file.

/*
 Description: Truncate Short Description @ WooCommerce Single Author: Mudassar Shakeel
 Websites:https://mcstarters.com/
*/
 
add_action( 'woocommerce_after_single_product', 'mcstarters_woocommerce_short_description_truncate_read_more' );
 
function mcstarters_woocommerce_short_description_truncate_read_more() { 
   wc_enqueue_js( '
      var show_char = 40;
      var ellipses = "... ";
      var content = $(".woocommerce-product-details__short-description").html();
      if (content.length > show_char) {
         var a = content.substr(0, show_char);
         var b = content.substr(show_char - content.length);
         var html = a + "<span class=\'truncated\'>" + ellipses + "<a class=\'read-more\'>Read more</a></span><span class=\'truncated\' style=\'display:none\'>" + b + "</span>";
         $(".woocommerce-product-details__short-description").html(html);
      }
      $(".read-more").click(function(e) {
         e.preventDefault();
         $(".woocommerce-product-details__short-description .truncated").toggle();
      });
   ' );
}

Step 4: Click the “Update File” button to save your changes.

See also  How To Display Long Descriptions Instead Of Short Ones on Single Product Pages | WooCommerce

After implementing the code, visit your WooCommerce product pages and ensure that the short descriptions are truncated as intended.

Conclusions

Enhance the user experience on your WooCommerce store by implementing this “Read More” toggle for truncated short descriptions. Your customers will appreciate the clean design and easy access to additional product details. Happy selling!

FAQs

What is the purpose of the “Read More” toggle?

The “Read More” toggle is a feature that allows users to view the full content of a truncated short description. By clicking the “Read More” link, additional text is revealed, giving customers the option to explore more details about the product without cluttering the initial view.

How to truncate long text and show the read more / less button?

Truncating long text and implementing a “Read More / Read Less” button in HTML and JavaScript can be achieved with a few lines of the above code.

Post Tags: #Woocommerce tips

Best VPN Services Cheapest Hosting converkit convertkit Create Custom Header Credit Cards CRM Software customization tips Customize Elementor Styles Detailed Comparison divi guide divi tips Elementor Error Elementor Guide Elementor mega menu Elementor Pro Elementor Templates Elementor tips email marketing tools Hosting service Insurance Industry integrate Elementor Form Managed hosting Marketing tools comparsions mega menu design NordVPN payment tips Shopify speed optimization tips & trick tools for small business Top CRM System webflow guide Webflow Tips Website builder Website navigations Woocommerce tips WordPress wordpress developer WordPress developer USA Wordpress guide wordpress guides WordPress Maintenance services WordPress plugin Wordpress support

Facebook FacebookTwitter TwitterInstagram InstagramPinterest PinterestYouTube YouTube

© 2025 Mc Starters Blog

  • Guest Posts
  • HTML Sitemap
  • XML Sitemap
  • Affiliate Disclosure
Scroll to top
  • Home
  • Company
    • About Us
    • Meet with Team
    • Media Assets
    • We’re Hiring
    • Contact Us
  • Top Categories
    • WooCommerce
    • Elementor
    • Webflow
    • Divi
    • WordPress
    • SEO
    • Payoneer Guides
    • Shopify Tutorials
    • Squarespace
    • Weebly
    • Wix
    • Website Builders
    • CRM
    • Payment
  • Tips and Tricks
    • AI
    • Business
    • Insurance
    • Resources
    • Review
    • Science and Technology
    • Windows 10
    • Windows 11
  • Services
    • WordPress Web Design
    • Elementor Expert
    • Divi Theme Experts
    • Blog Setup
    • WordPress Customization
    • E-Commerce Websites
    • Crocoblock Expert
    • Hire Webflow Expert
  • Free Templates
    • Elementor Templates
    • Elementor Header
    • Elementor Footer
    • Elementor Single Post Templates
    • Elementor Mega Menu
    • Divi Templates
    • Divi Header Layouts
    • Divi Footer Layout
  • Tools
  • Guest Posts
Facebook X Instagram YouTube Pinterest
Search