Support » Plugin: WooCommerce » How to extend product short description ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • crslz

    (@crslz)

    add_filter('woocommerce_short_description', 'limit_product_short_description', 10, 1);
    function limit_product_short_description($post_excerpt) {	
    	$limit = 14;
    	
    	$pieces = explode(" ", $post_excerpt);
    	$post_excerpt = implode(" ", array_splice($pieces, 0, $limit));
    	
    	return $post_excerpt;
    }

    explode breaks the original string into an array of words, array_splice lets you get certain ranges of those words, and then implode combines the ranges back together into single strings.

    Plugin Support Austin M

    (@apmwebdev)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any further questions!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.