I am trying to add line breaks to my product titles and I cannot figure out how to code it. Any help or advice would be amazing!!
1 Like
Hi @Haileekayhair ,
Can you share your website so we know what are we dealing with? Is your product titles were long?
Thank you. I see the product titles. How are you thinking of separating the words in the title?
Id like it to say the title of the product on top and then the secondary description below it. For example, right now it says
Aquachobee - Tinsel Baby Blue Festival Braiding Hair
Id like it to appear like
Aquachobee
Tinsel Baby Blue Festival Braiding Hair
Thank you for the explanation. You can achieve it by replacing the product.title code
- From your Admin Page, click Online Store > Themes >Actions > Edit code
- In the Section folder, open the main-product.liquid
- Find the first {{ product.title | escape }}, see image below
- Replace the {{ product.title | escape }} with the code below.
{% if product.title contains "-" %}
{% assign productTitle = product.title | escape | split: "-" %}
{{ productTitle[0] }}
{{ productTitle[1] }}
{% else %}
{{ product.title | escape }}
{% endif %}
See image below for placement
Thank you so much! Is there any chance I can have you do this for me? Im struggling to make it work. Im not sure what Im doing wrong

