Re: How to add line break in product title?

Solved

How to add line break in product title?

jadedheart32
Tourist
10 0 3

This is on a product page. The attached image is the desktop view, and I want the break to look like:
"Cat Harness
and Leash Set"

 

Screen Shot 2024-10-21 at 12.50.55 PM.png

Accepted Solutions (3)
Moeed
Shopify Partner
6619 1789 2173

This is an accepted solution.

Hey @jadedheart32 

 

Follow these Steps:

1) Go to Online Store
2) Edit Code
3) Find theme.liquid file

4) Add the following code in the bottom of the file above </body> tag

<style>
.product__title>* {
    width: 50% !important;
}
</style>

RESULT:

Moeed_0-1729535050436.png

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


View solution in original post

PaulNewton
Shopify Partner
7640 671 1604

This is an accepted solution.

Hi @jadedheart32 to have consistent layout across devices/screen-sizes AND have granular control over title line breaks requires an advanced theme customization.

You need to replace the titles with metafields duplicating the title with the addition of a character/sequence that indicates where to split/break the title up.

If you just try to do it with only the title you'll either need all titles to have a consistent word to break on, or have to add spurious characters that customers shouldn't see or don't make sense on some sales channels, and can still get inconsistent behavior across devices/screen-sizes.

 

If you need this customization then contact me for services
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


View solution in original post

Dan-From-Ryviu
Shopify Partner
10793 2133 2251

This is an accepted solution.

Hi @jadedheart32 

You can try to follow these instructions:

  • Login to Shopify admin
  • Go to Online Store > Themes

  • Find the Dawn theme and click on '...' > Edit code.
  • Open main-product.liquid file, look for the code that displays the product title like this 

 

<h1>{{ product.title | escape }}</h1>

 

  • Replace it with this code 

 

<h1 class="product-title">
  {% assign title_parts = product.title | split: "and" %}
  {{ title_parts[0] }}<br>{{ title_parts[1] }}
</h1>​

 

  • Save your file and check again. 

- Solved it? Hit Like and Accept solution! ❤️Buy Me Coffee❤️
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

View solution in original post

Replies 8 (8)

Moeed
Shopify Partner
6619 1789 2173

Hey @jadedheart32 

 

Welcome to Shopify Community! Can you share your Store URL so I can have a look on it? Also, if you have password enabled then please share the password as well. Your cooperation would be greatly appreciated.

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


Moeed
Shopify Partner
6619 1789 2173

This is an accepted solution.

Hey @jadedheart32 

 

Follow these Steps:

1) Go to Online Store
2) Edit Code
3) Find theme.liquid file

4) Add the following code in the bottom of the file above </body> tag

<style>
.product__title>* {
    width: 50% !important;
}
</style>

RESULT:

Moeed_0-1729535050436.png

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


jadedheart32
Tourist
10 0 3

How do I control the breaks on different media sizes. It's breaking weird on tablet.

PaulNewton
Shopify Partner
7640 671 1604

This is an accepted solution.

Hi @jadedheart32 to have consistent layout across devices/screen-sizes AND have granular control over title line breaks requires an advanced theme customization.

You need to replace the titles with metafields duplicating the title with the addition of a character/sequence that indicates where to split/break the title up.

If you just try to do it with only the title you'll either need all titles to have a consistent word to break on, or have to add spurious characters that customers shouldn't see or don't make sense on some sales channels, and can still get inconsistent behavior across devices/screen-sizes.

 

If you need this customization then contact me for services
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


Dan-From-Ryviu
Shopify Partner
10793 2133 2251

This is an accepted solution.

Hi @jadedheart32 

You can try to follow these instructions:

  • Login to Shopify admin
  • Go to Online Store > Themes

  • Find the Dawn theme and click on '...' > Edit code.
  • Open main-product.liquid file, look for the code that displays the product title like this 

 

<h1>{{ product.title | escape }}</h1>

 

  • Replace it with this code 

 

<h1 class="product-title">
  {% assign title_parts = product.title | split: "and" %}
  {{ title_parts[0] }}<br>{{ title_parts[1] }}
</h1>​

 

  • Save your file and check again. 

- Solved it? Hit Like and Accept solution! ❤️Buy Me Coffee❤️
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

jadedheart32
Tourist
10 0 3

This works beautifully thank you!

Dan-From-Ryviu
Shopify Partner
10793 2133 2251

You are very welcome! 

- Solved it? Hit Like and Accept solution! ❤️Buy Me Coffee❤️
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.