I'd like to show most the 10 most recent products added to any of my collections

Shopify Partner
1 0 0

Any help is appreciated :)

0 Likes
Highlighted
Shopify Partner
115 0 7

Because product.created_at and product.published_at are not accessible through liquid you cannot do this with just liquid.

Luckily there is a work around.

 

Get your 10 most recently created products:

You will need to create a collection using the condition "Product price is greater than $0". This will include all products in the collection. Then you will need to sort the collection by "Date: Newest to Oldest". Once you do this it iwill be easy to get your 10 newest products. You can just use this liquid snippet:

 

<!-- Where "my_collection" is your newly created collection's handle -->

{% for product in collections.my_collection.products limit: 10 %}
  <!-- Your Markup Here -->
{% endfor %}

 

The downside of this workaround is that this collection will now show up on your "/collections" page. There are ways to get around this but I won't get into that here.

 

Get your 10 most recently created products in a specific collection:

To get the 10 most recently added products in a specific collection you can just sort the collection by "Date: Newest to Oldest" then use the same snippet I provided previously.

1 Like