Truncated description on collection page

pearlerwork
Excursionist
19 0 5

I'm showing a truncated description on the collection page using this code:

{{ product.description | strip_html | truncate: 170 }} 

 

I'm wondering how I might be able to hide unwanted text - I've seen some blog posts use this:

<!--split-->

 

But I'm not sure how it translates in this context? The pink arrow shows the text I don't want to appear. 

 

Image 2021-07-13 at 11.12.01 am.png

Website → 

0 Likes
mkamalkayani
Explorer
65 5 5

Hi,

what do you mean by "unwanted text"?

Maybe this is helpful: Liquid string filters

0 Likes
pearlerwork
Excursionist
19 0 5

@mkamalkayani Thanks - in my original post, you can see I've highlighted some text I don't want to appear. Perhaps it would be good if only the first <p> tag text appeared:

<p>This lightly foaming shampoo helps create and maintain a healthy hair growing environment. It is formulated to revitalize your scalp microbiome and gently remove follicle-clogging sebum.</p>
<!-- split -->
<h5><span>Ingredients</span></h5>
<p>Water (Aqua), Sodium Cocoyl Isethionate, Decyl Glucoside, Cocamidopropyl Hydroxysultaine, Cocamidopropyl Betaine, Cetrimonium Chloride, Glycol Distearate, Phenoxyethanol, Ethylhexylglycerin, Polyquaternum-10</p>
0 Likes
mkamalkayani
Explorer
65 5 5

I am sorry, I couldn't understand your question.

I can't provide a good solution unless I have a good understanding of the problem.

0 Likes
LitExtension
Shopify Partner
1164 144 204

You just need to change the code:
{{ product.description | strip_html | remove: "text" | truncate: 170 }}
Ex: {{ product.description | strip_html | remove: "ingredients" | truncate: 170 }}
Hope it helps!

LitExtension - Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
0 Likes