Last active
June 18, 2020 07:15
-
-
Save Lysindr/d1551b370b5a075f99d248d220c518f2 to your computer and use it in GitHub Desktop.
Shopify Liquid RANDOM MIN MAX code example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
!!! IMPORTANT !!! - the date variables CACHED ON LIVE THEME and DON'T CHANGE AFTER PAGE RELOAD. | |
{% endcomment %} | |
{% assign min = 0 %} | |
{% assign max = try_collection.all_products_count %} | |
{% assign diff = max | minus: min %} | |
{% assign timestamp = "today" | date: "%s" | plus: 0 %} | |
{% assign randomNumber = timestamp | modulo: diff | plus: min %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment