Displaying products on custom template page

Shopify Partner
2 0 1

Hi, I want to display 4 most recent products in my custom page template.
I tried this code, but it's not grabbing products from collection. I'm using FLOW theme.
Thank you for any help.
 

<div class="featured-products">
  {% for product in collections.collection.products limit: 4 %}
    <li>
      <img src="{{ product.featured_image | product_img_url: 'medium' }}" alt="{{ product.title | escape  }}" />    
      <a class="shop-now" href="{{ product.url }}">{{ product.title | escape  }}</a>                              
    </li>  
  {% endfor %}
</div>

 

0 Likes
Shopify Partner
2 0 1

Alright, I solved it. I will leave my code here if someone will need it.
 

{% for product in collections.all.products limit: 4 %}
    <li>
      <img src="{{ product.featured_image | product_img_url: 'medium' }}" alt="{{ product.title | escape  }}" />    
      <a class="shop-now" href="{{ product.url }}">{{ product.title | escape  }}</a>                              
    </li> 
{% endfor %}

 

1 Like
New Member
1 0 0

Tks bro you just saved my day!!!

0 Likes