james-a of Underwaterpistol
12/1/2017 - 11:14 AM

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 %}