Shopify themes, liquid, logos, and UX
Hey There
Im trying to create line breaks for my product title.
This is what it looks like now. Ideally I would like it to read like this:
doodles tee
vintage black
$46
thank you.
Solved! Go to the solution
This is an accepted solution.
you can break your title with this code. ( if they all connect via ' - '
{% assign product_title_arr = product.title | split: " - " %}
{% for product_title_item in product_title_arr %}
{{ product_title_item }}
{% endfor %}
This is an accepted solution.
1: Online store > themes > Actions > Edit code > Sections > product-template.liquid
2: find the class name 'product-single__title', if you have not edited code before then its in line 131
demo ( you can edit base on it
{% assign product_title_arr = product.title | split: " - " %}
{% for product_title_item in product_title_arr %}
{% if forloop.index == 1 %}
<h1 class="product-single__title" itemprop="name">
{{ product_title_item }}
</h1>
{% else %}
<p>{{ product_title_item }}</p>
{% endif %}
{% endfor %}
This is an accepted solution.
code coming~~~~~🤣
1: Online store > themes > Actions > Edit code > Snippets > product-grid-item.liquid
{% assign grid_product_title_arr = product.title | split: " - " %}
{% for grid_product_title_item in grid_product_title_arr %}
<span class="grid-product__title" style="display:block">
{{ grid_product_title_item }}
</span>
{% endfor %}
This is an accepted solution.
you can break your title with this code. ( if they all connect via ' - '
{% assign product_title_arr = product.title | split: " - " %}
{% for product_title_item in product_title_arr %}
{{ product_title_item }}
{% endfor %}
This is an accepted solution.
1: Online store > themes > Actions > Edit code > Sections > product-template.liquid
2: find the class name 'product-single__title', if you have not edited code before then its in line 131
demo ( you can edit base on it
{% assign product_title_arr = product.title | split: " - " %}
{% for product_title_item in product_title_arr %}
{% if forloop.index == 1 %}
<h1 class="product-single__title" itemprop="name">
{{ product_title_item }}
</h1>
{% else %}
<p>{{ product_title_item }}</p>
{% endif %}
{% endfor %}
Hey! This worked for my product pages, which is fantastic.
But, its still displaying with " - " on collections pages.
any fix for that?
This is an accepted solution.
code coming~~~~~🤣
1: Online store > themes > Actions > Edit code > Snippets > product-grid-item.liquid
{% assign grid_product_title_arr = product.title | split: " - " %}
{% for grid_product_title_item in grid_product_title_arr %}
<span class="grid-product__title" style="display:block">
{{ grid_product_title_item }}
</span>
{% endfor %}
Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025