WooCommerce Product Title Length

Posted in: Newspaper
Post count: 8

Hi,

I’ve tried to use WP functions.php to limit the product title by words and add “ellipsis / …” at the end but it seems unable to achieve that.

Newspaper version: 12.5

Here is the code:


add_filter( 'the_title', 'shorten_woo_product_title', 10, 2 );
function shorten_woo_product_title( $title, $id ) {
    if ( ! is_singular( array( 'product' ) ) && get_post_type( $id ) === 'product' ) {
		 return mb_strimwidth($title, 0, 6, '...');// change last number to the number of words you want
    } else {
        return $title;
    }
}

Any help would be greatly appreciated. Thank you.

Post count: 21065

Hello @kkvideography !

This will require custom work, which is not covered by the support team.
I will add this request to our improvement list!

Thank you!

Post count: 8

Thanks but I believe this is an important feature for WooCommerce since there is no method to reduce or limit like in ‘Posts’ even using functions.php.

Tried CSS but it looks weird as well.

Appreciate your feedback on this matter.

Post count: 21065

Hello @kkvideography !

We will take in consideration your query!

Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.