Product name on several lines on home and category views

Ideally, you should use a child theme to override existing code rather than update core code. Otherwise your changes will be wiped when you come to update your theme one day.

My PHP isn’t amazing, but it looks like you’re echoing a variable that refers to itself - Hence “Undefined variable”. Check your reference as I’m sure it should be more like:

<?php echo $name = wordwrap( $_productNameStripped, 20, "<br />\n",false);?>
  • $name is the variable you want to create
  • $_productNameStripped refers to an existing variable (a few lines up) which is the product name

I’m unable to test this right now to test/check anything. But you’ll find some very basic variables of PHP Wordwrap Function here. As you can see, the 2 variables withing the line in Example 1 are different.

Oh, and FYI Magento_Catalog/templates/product/list.phtml isn’t related to the Homepage. It’s related to listing products in categories. Typically, a Homepage doesn’t list products so I’m not sure what you’re trying to do. Some screenshots or something would help to show:

  1. Your current page
  2. What you’re trying to achieve (Photoshoped)