Last active
April 23, 2026 17:58
-
-
Save giodc/84bd1d8f6b6468847c416a77bb9317c8 to your computer and use it in GitHub Desktop.
Judge me Shopify - link star rating to Reviews section - for Horizon Theme (should work for any theme)
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
| add in theme.liquid before </body> tag. | |
| WITH STANDARD HEADER | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function () { | |
| const ratingWrappers = document.querySelectorAll('.rating-wrapper'); | |
| const reviewsSection = document.getElementById('judgeme_product_reviews'); | |
| if (!reviewsSection) return; | |
| ratingWrappers.forEach(function (wrapper) { | |
| // Make it look clickable | |
| wrapper.style.cursor = 'pointer'; | |
| wrapper.addEventListener('click', function () { | |
| reviewsSection.scrollIntoView({ | |
| behavior: 'smooth', | |
| block: 'start' | |
| }); | |
| }); | |
| }); | |
| }); | |
| </script> | |
| WITH STICKY HEADER | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function () { | |
| const ratingWrappers = document.querySelectorAll('.rating-wrapper'); | |
| const reviewsSection = document.getElementById('judgeme_product_reviews'); | |
| if (!reviewsSection) return; | |
| ratingWrappers.forEach(function (wrapper) { | |
| wrapper.style.cursor = 'pointer'; | |
| wrapper.addEventListener('click', function () { | |
| const offset = 80; // adjust to your header height in px | |
| const top = reviewsSection.getBoundingClientRect().top + window.scrollY - offset; | |
| window.scrollTo({ top, behavior: 'smooth' }); | |
| }); | |
| }); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment