STORENVY

STORENVY

How can I display a link to all products?

'All Products' is no longer a collection in stores created after July 22nd 2013 or stores who manually upgraded to the Cooper theme so the liquid element 'collections.all' no longer includes the 'All Products' collection. This means that the code used to display all the collection names will not include 'All Products' anymore. For example:

<ul id="nav">
     {% for nav_item in collections.all %}
     <li id="collection_{{nav_item.id}}_link" {% if nav_item =collection %} 
                     
class="current" {% endif %}>
          <href="{{nav_item.url}}">{{ nav_item.nam}}</a>
     </li>
     {% endfor %}
     </ul>

To manually add a link to all your products or 'Shop All' to a custom theme created before July 22nd 2013 or to include this in a new theme you are creating, you will need to add an extra few lines to this:

<ul id="nav">
      <li>
           <href="/products">Shop All</a>
      </li>
      {% for nav_item in collections.all %}
      <li id="collection_{{nav_item.id}}_link" {% if nav_item =collection %} 
                    
class="current" {% endif %}>
            <href="{{nav_item.url}}">{{ nav_item.nam}}</a>
      </li>
      {% endfor %}
      </ul>

Did you find this article helpful?