How can I sort collection items by publish date, not created date?

Topic summary

Main issue: Sort collection products by publish date (published_at) instead of created date in Shopify (Debut theme). Users want newest-by-publish-date ordering across collections.

What works for many: Use Liquid to sort collection.products by published_at and loop over a reassigned array (e.g., collection_products). Some tie it to the sort_by parameter (created-ascending/descending) to reuse Shopify’s UI options. product.published_at is the publish timestamp; created_at can’t be changed. Draft → publish can reset published_at; scheduling sets future publish times.

Key limitations and pitfalls:

  • Front-end sorting conflicts with pagination. Shopify paginates collection.products server-side, so sorting often affects only items within a page, causing wrong order and blank grid gaps. Arrays like reassigned lists can’t be paginated. A suggested workaround is wrapping with paginate all_products by 50, but it only helps when total products < 1000 and Shopify now limits loops to ~50 per page.
  • Large catalogs (>1000) and pagination: no reliable theme-only solution; removing pagination can work but may hurt performance.
  • Metafield-based date sorting didn’t work for some.

Alternatives/outcomes:

  • Apps (e.g., Advanced Collections) sort on the backend and avoid pagination issues.
  • Some use Mechanic to automate ordering.

Status: No native Shopify option; partial code workarounds exist, but large catalogs/pagination remain unresolved.

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

@thevault You can use {% assign collections = collections | sort: ‘published_at’%}

For example, the code responsible for https://nichegeek.myshopify.com/collections/ would be as given below (sections/list-collections-template.liquid)

{% assign collections = collections | sort: 'published_at'%}
        {% for collection in collections %}
        {% if collection.products_count != 0 %}
          <li class="grid__item {{ grid_item_width }}">
            {% include 'collection-grid-item', collection_image_size: image_size %} 
             {{collection.published_at | date: "%a, %b %d, %Y"}}
          </li>
    {% endif %}
{% endfor %}