• Resolved husk3r

    (@husk3r)


    Hello, when a product has a title longer than other products, it makes the product not the same size, how can I fix this

    • This topic was modified 6 years, 9 months ago by husk3r.
    • This topic was modified 6 years, 9 months ago by husk3r.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter husk3r

    (@husk3r)

    is there a plugin that can help or css?

    Try this code:

    add_filter('the_title', 'modify_title', 10);
    function modify_title( $title ) {
      if ( is_woocommerce() || is_product_category() ) {
        if ( strlen( $title ) > 12 ) {      
          $title = substr($title, 0, 12).'...';
        }
      }
      return $title;
    }

    The ’12’ is the maximum number of characters you want to allow. Adjust the number to your preference.

    The code goes in functions.php for your child theme or you could use the “My Custom Functions” plugin or similar.

    Thread Starter husk3r

    (@husk3r)

    Thank you but that cuts the title, my product titles are not so long , they can fit in two lines basically, but some of them are just one line long
    this is my store
    https://tienda.homeservices.co.cr/tienda/

    OK. You can get some regularity by specifying a minimum height for the title block with this custom css:

    .woocommerce-loop-product__title {
      min-height: 46px;
    }

    Custom css can be entered at Appearance > Customize > Additional CSS

    However, your images have different aspect ratios, so they will show the same width but their heights will be different. Its possible to force the image heights to be the same but then there will be some distortion.

    This will hide the dots over the page numbers:

    .page-numbers li {
      list-style: none;
    }
    Thread Starter husk3r

    (@husk3r)

    That works!, thank you very much!
    Thank you for your help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Make all shop items description boxes the same size’ is closed to new replies.