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 %}
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024