`
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 substr( $title, 0, 20) . '…'; // change last number to the number of characters you want
} else {
return $title;
}
}
`
I have this code to limit product title characters in homepage:
i want to modify it to limit the characters of the description in the single product page of woocommerce. How to do? Thank you
I tried to replace 'the_title' with 'description' but it doesn't work