Show newest products in section on homepage

Topic summary

Goal: show the newest products on the homepage by sorting products by publish date (published_at) in Liquid and rendering a limited list.

Issue: sorting collections.all.products by published_at (descending) did not match the “All” collection when sorted in the storefront as “Date: New to Old,” producing inaccurate results.

Implementation details: assign all_products = collections.all.products | sort: ‘published_at’ | reverse, then loop over all_products with a limit (section.settings.limit) and render ‘product-item’. The Liquid code and the published_at field are central to the issue.

Update/Workaround: creating a separate “Newest Products” collection that includes all products achieved the correct “newest first” output, whereas using the “All” collection did not.

Status: unresolved. The user asks why the approach fails specifically with the “All” collection; no definitive explanation or action items were provided.

Summarized with AI on December 21. AI used: gpt-5.

I am trying to create a section on the home page to show newest products published using the following code, however I am not getting accurate data:

assign all_products = collections.all.products | sort: 'published_at' | reverse

It’s just not giving me the latest products compared to when I go to the All Collection sort by Date New to Old

Here is how I am rendering the products:

{% liquid
                    for product in all_products limit: section.settings.limit
                        render 'product-item', product: product
                    endfor
                %}

What could be the issue?

This worked but I had to create a collection called Newest Products that listed all products for it to work.

Any reason this didnt work with the All collection?

Thank you.