I am trying to find the values in an array if the values are there need to remove and print those values. I had tried the below code but it is not working. Please advise
color_filter => color bowl_filter1 => bowl
{{#and (filter (split this.display_name '_') 'filter') (filter (split this.display_name '_') 'filter1') }}
{{#each (split this.display_name '_') }}
{{#and (if this '!=' 'filter') (if this '!=' 'filter1')}}
{{this}}
{{else}}
:
{{/and}}
{{/each}}
{{else}}
{{ this.display_name }}:
{{/and}}
Thanks in advance
If I am understanding this correctly, you are looking to chop off the underscore and everything after it?
In that case, you could simply use the following code, as it would accomplish this:
And if you use underscores in other values and only want to remove it if filter is there after, you could use this code instead:
Let me know if this helps, or if I am off-base here. It may help to have some extra context added here. For example, where are you doing this. Is this in the faceted search on the category page, based on custom fields of the products?