Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am using Ajaxinate to have endless scroll in my colletion template. Shopify product review badge only appears for the first products of the pagination. I've noticed that SPR need to be reinit/refreshed everytime that a http request is made. So how can i access SPR element in my js file?
i've got this error when try to access the object
- Uncaught ReferenceError: SPR is not defined
Solved! Go to the solution
This is an accepted solution.
i solved this issue simulating another http request.
var request = new XMLHttpRequest(); request.open("GET", ""); request.onload = function() { SPR.registerCallbacks(); SPR.initRatingHandler(); SPR.initDomEls(); SPR.loadProducts(); SPR.loadBadges(); }; request.send();
but it is not a good solution. Waiting for new solutions or ideas/advices.
This is an accepted solution.
i solved this issue simulating another http request.
var request = new XMLHttpRequest(); request.open("GET", ""); request.onload = function() { SPR.registerCallbacks(); SPR.initRatingHandler(); SPR.initDomEls(); SPR.loadProducts(); SPR.loadBadges(); }; request.send();
but it is not a good solution. Waiting for new solutions or ideas/advices.
@marquinhos
You need to contact app support and tell them you are using infinite scrolling on the collection page so they will change code. After that, your issue will be fixed.
Thanks A lot, Its works on "load more" and "infinite scrolling"
Much appreciated; this worked for me. I was looking at how to load SPR dynamically as my pages are loading through Turbo-Links.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025