How To Remove Any Duplicate Items In A Shopify Array
In this article, you will learn how to remove duplicates from an array in Shopify liquid.
In fact, Shopify liquid supports that with the filter called uniq
.
Eg:
1 2 | {% assign hura_array = "A, A, B, C, C, B, D, A, D, E" | split: ", " %} {{ hura_array | uniq | join: ", " }} |
Output A, B, C, D, E
I hope it’s helpful to you.