PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] How to display products from specific tag in shopify?

 June 30, 2022     shopify, shopify-app, shopify-template     No comments   

Issue

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

{% for product in collections.all.products %}   
{% if product.tags contains "organic" %} 
 {% include 'product-list-item' %}  
{% endif %}
{% endfor %}


Answered By - Info
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing