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

Saturday, July 2, 2022

[FIXED] How display all top 1 product on collection list one one page?

 July 02, 2022     collections, shopify     No comments   

Issue

I'm trying to display all top 1 product on the collection on one page. but I know how to do that.

I share upload three screenshots I want them to display on one page. Any tips?

enter image description here


Solution

There are a lot of ways to do this.

1 way. Start by creating a new collection with a condition, select product type is equal to top 1. In the product you want to appear in that collection, add top 1 to the type.

  1. {% for collection in collections %}
     {% for product in collection.products %}
         {% if forloop.index == 1%}
         {% comment %}display product{% endcomment %}
         {% endif %}
     {% endfor %} {% endfor %}
    

The above code will select first product on every collections in the shop. To control which to appear as first, go to the collection and select the sort orders.



Answered By - Charles C.
Answer Checked By - Gilberto Lyons (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