tara-m of Underwaterpistol Code Snippets
1/30/2019 - 2:50 PM

Check Same Name

{% assign is_duplicate = false %} 
{% for check_product in collections.[collection.handle].products %}
  {% for product in collections.[collection.handle].products %}
    {% unless product.id == check_product.id %}      <-- Ensure you're not just checking the same product against itself-->
      {% if product.title == check_product.title %}
        {% assign is_duplicate = true %}   <-- i.e. you've found a duplicate!
      {% endif %}
    {% endunless %}
  {% endfor %}
{% endfor %}

{% if is_duplicate %}
Do something...
{% else %}
Do something different...
{% endif %}