'How to display products from specific tag in shopify?

How to display products from specific tag "organic" in shopify custom template? Here is my code.


{% if customer.tags contains 'organic' %}                    
<div class="product-list product-list--collection"> 
      {%- for product in collections.all.products  limit: product_limit-%}  
              {% for c in product.collections %}
          {% if c.title == collection.title %}
                              {%- render 'product-item' -%}  
            {% endif %}  
            {% endfor %}  
              {% if collection.handle=="all" %}
                           {%- render 'product-item' -%} 
                {% endif %}  
      {%- endfor -%}   
   </div>            
{% else %}
 <div class="product-list product-list--collection 
                                {% if has_filters %}
                                product-list--with-sidebar
                                {% endif %}">
                      {%- for product in collection.products -%}
                                  {%- render 'product-item' -%}
                      {%- endfor -%}   
   </div> 
{% endif %}


Solution 1:[1]

it will help in displaying the specific product title , Please also check the API documentation here

{% for tag in customer.tags %}
  {% if tag == 'organic' %}

  {% assign collection = collections[my-collection-handle] %}
  
  {% paginate collection.products by 99 %}
  {% assign products = collection.products %}

  {% if collection.products.size > 0 %}

  {% for product in products %}
    {% for tag in product.tags %}
      {% if product.tag == 'limited_edition' %}
        <p>{{ product.title }}</p>
      {% endif %}
    {% endfor %}
  {% endfor %}

  {% endif %}

  {% endpaginate %}
    
  {% endif %}
{% endfor %}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1