Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I have a Color metafield:
- Single Line
- Value List
Where I want to put the product colors in.
Sometimes only one, sometimes 5 colors per product.
Now I want to display the color(s) to the customer in a single line seperated by a "/".
This is the output if you render the metafield like :
{{ product.metafields.custom.color.value }}
Both tags have no space in-between
And this is the output if I´m trying to use the "Split" function:
{{ product.metafields.custom.color.value | Split:"/" }}
Why does it render the "(" brackets?
This is how the metafield is set up
The Code that renders the Color Variant:
<p class="related-products-heading" style="font-size: {{block.settings.heading_font_size}}px; color: {{block.settings.heading_color}};">{{ block.settings.heading }}
<span style="color: #acacac;">Farbe: </span> <span style="color: #4DA9A9;"> {{ product.metafields.custom.color.value }}</span>
</p>
Any ideas how to solve my issue?
Of course you can do something like this:
{{ product.metafields.custom.color.value | remove: "[" | remove: "]" | remove: '"' | split: "/" }}
But at the end the "/" still does not work and will only render a ",":
Bump!