display product description woocommerce code example

Example: WooCommerce Add Long Description to Products on Shop Page with Character limit

/**
 * WooCommerce, Add Long Description to Products on Shop Page with Character limit
 *
 * @link https://wpbeaches.com/woocommerce-add-short-or-long-description-to-products-on-shop-page
 */
add_action( 'woocommerce_after_shop_loop_item_title', 'wc_add_long_description' , 9);
function wc_add_long_description() {
  global $product;

  ?>
        <div itemprop="description">
            <?php echo substr( apply_filters( 'the_content', $product->post->post_content ), 0,77 ); echo '...' ?>
        </div>
  <?php
}

Tags:

Misc Example