Created
October 3, 2023 20:26
-
-
Save tpage99/3f8f6e5f3e8601d5d62de61955343f41 to your computer and use it in GitHub Desktop.
Create a random number with Liquid for Customer Testimonials Metaobject
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 %} | |
my_reviews is an array of metaobjects assigned via metafields | |
{% endcomment %} | |
{% liquid | |
assign review_min = 1 | |
assign review_max = my_reviews.size | |
assign mod_ref = review_max | minus: review_min | |
assign random_number = "now" | date: "%N" | modulo: mod_ref | plus: review_min | |
assign review = my_reviews[random_number] | |
%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment