Description:
On search results pages, when infinite scroll is enabled, products from the last visible row are duplicated when the next page is loaded. This happens consistently after scrolling enough to trigger loading of the next page.
Instead of appending only new products, the script re-inserts the final row from the previous page, resulting in duplicated product cards.
Steps to reproduce:
Go to any search results page (example: /search?q=buchet+mireasa)
Scroll down until infinite scroll loads the next page
Observe the product grid after the page changes
Expected behavior:
Only new products from the next page should be appended to the grid.
Actual behavior:
The last row of products from the previous page is duplicated and displayed again at the top of the newly loaded products.
Hello, I investigated this bug and can provide you a temporary solution. This requires a small code addition.
Go to your theme editor, and click the 3 dots in the upper left, to see a menu pop up with the Edit Code button, click it. Then, look for search-results.liquid in the sections folder on the left panel.
In that file you should look for line 31, that looks like this:
It turns out that this bug manifests even outside of the Infinite Scroll mode. This fix removes the duplicated products, which unfortunately makes pages after the first one always show less products than they should, but it is unlikely that customers will notice. I’m not sure what the cause of this is for now, but I’ll try to investigate it some more to see if there isn’t a better way.
Don’t forget to like and even accept this answer, thank you.
I wanted to let you know that the bug is fixed now. To revert back the changes, simply follow my original post again, but this time, replace the second code block with the first one. I strongly recommend you do so, otherwise certain items are going to be skipped over in search results.