Split two product options to create a label

Split two product options to create a label

IKRDE
Explorer
40 2 5

Hi,

 

in my liquid i am fetching the options/variants from a product with:

{{ product.options}}

 

That works and i will get the result for each option like this

GeräteJahre

 

But i want to have Geräte / Jahre

 

So i was trying to do this

{{ product.options | split: ' ' | handle | replace: "-", " / "}}

 

but the result is

gerate / jahre (german ä as well missing)

 

How i can get it to Geräte / Jahre

 

 

Many thanks

Replies 2 (2)

IKRDE
Explorer
40 2 5

I know and understand that you can not promote your App or Services in here, but i would really appreciate some help. Many thanks.

tim
Shopify Partner
3997 415 1474

I doubt many people are paid to help here. 

You can't expect people to sit and monitor these forums 42/7 for free, can you?

 

Now to your question -- product.options is already an array, so splitting it will do nothing good.

I also see no reason to use handle since what it does among other things is down-case, replace non-ascii characters with best ascii matches and replace spaces, etc with dashes.

 

You'd only need to do {{ product.options | join: " / " }} to get what you want.

Hope this helps.

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com