Viewing 1 replies (of 1 total)
  • Plugin Author weDevs

    (@wedevs)

    Hello,

    By adding the following code you will be able to limit the number of characters of the product name.

    File location wp-content/themes/[your-theme-name]/functions.php

    add_filter( 'the_title', 'limit_product_title', 10, 2 );
    
    function limit_product_title( $title, $id ) {
        if ( is_page() && get_post_type( $id ) === 'product' && strlen( $title ) > 15 ) {
            return substr( $title, 0, 15 ) . '...';
        } else {
            return $title;
        }
    }

    You should change the number 15 by your desire number, and you will notice the change.

    return substr( $title, 0, 15 ) . '...';

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Add New Product – How to limit the number of chars of product name?’ is closed to new replies.