Product Title cut between commas

Highlighted
New Member
2 0 0

Structure of the title:

123, Product Name, MPN 934

 

I need to cut the information between commas and show only Product Name

I tried to use split, but doesnt work. Has anybody an suggestion?

 

{{product.title}}

 

Thank you

 

 

0 Likes
Highlighted
Shopify Partner
821 168 189

Hello,

Try this

{% assign split_title = product.title | split: ", " %}

{{ split_title[1] }}
Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
1 Like
Highlighted
Shopify Expert
1381 111 196

try this

{{ product.title | split: "," | Last }}
0 Likes
New Member
2 0 0

Is it also possible to initiate a check if a title is formatted like this?

 

Product Name, MPN 934

 

If the title doesnt include two commas to cut, otherwise it works on the first version :)

0 Likes
Highlighted
Shopify Partner
821 168 189
{% assign title = product.title %}
{% assign split_title = title | split:", "  %}
{% assign split_size =  split_title.size | minus:1 %} 
{% if split_size >=2 %}
	{{ split_title[0] }}
{% else %}
	{{ title }}
{% endif %}
Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
1 Like