Hello, is it possible to randomize the order products in collection page? In order to have also a random order in product carousels.
Please can you tell me a liquid code example?
Thank you
Hello, is it possible to randomize the order products in collection page? In order to have also a random order in product carousels.
Please can you tell me a liquid code example?
Thank you
Can anyone help. Shopify must have random sort order option by default & it must have setting for days to reshuffle random order. For example products in selected collection will sort randomly every 7 days.
Charging monthly fees for required seems very unreasonable.
Is not that simple to create a Random Order for a Collection, but I have found a quite close, and in my opinion, very similar solution.
In my store I have a collection “New arrivals”, I want the shop to show some Random products from that collection, not the same every time.
So the solution I came by is not to select them all at random, but to randomly select a point to start and skip the products up to that point, for example if your collection have 100 products, and you want to show 8, you can select any number between 1 to 92 and show 8 products from there.
Is not exactly random, and because Shopify have cache It wont show different results every time, but it will change several times in an hour and show different products to regular visitors to your store in that section, so it solves the neccesity.
How this works:
Firstly, calculate a random start index based on the current time and ensure it’s within the range to display the full set of products you want:
{% assign total_products = collection.products.size %}
{% assign max_start = total_products | minus: length %}
{% assign start_index = “now” | date: “%S” | modulo: max_start %}
In this code, length is the number of products you wish to display. We use the current second to generate a random number, ensuring the starting index plus the product count doesn’t exceed the total available products.
Next, iterate over your collection’s products and start displaying them only when the loop’s index reaches the randomly chosen starting point:
{% assign products_shown = 0 %}
{% for product in collection.products %}
{% if forloop.index0 >= start_index %}
{% assign products_shown = products_shown | plus: 1 %}
{% if products_shown >= length %}{% break %}{% endif %}
{% endif %}
{% endfor %}
Here, we’re controlling the flow with if conditions to start showing products only after hitting our start_index and to stop after displaying the desired number of products (length).
This approach keeps your product display efficient while adding a dynamic touch to your Shopify collection pages. It’s a simple solution that keeps the user experience fresh without requiring complex coding or external tools.
Hope this helps!
You approach is truly good. But I found a app which provide randomizing as well as merchandising the products. Its free upto 2 catalog which is good for small stores.
App name - Jedi Product & Collection Sort
Hi @FrancescoMi89,
Shopify does not natively support true shuffle/random product ordering at the platform level.
Shopify Admin / Collection settings → Products can only be sorted by:
Best selling
Alphabetical
Price (high–low / low–high)
Date (newest/oldest)
Manual order
There is no built-in “shuffle/random” option.