Horizon theme bug - Infinite scroll duplicates last row of products on search results page

Theme: Horizon 3.2.1 (also happening in previous versions like 3.0.1)
Store: atelier.secretgarden.ro
Affected page: Search results (/search?q=...)
Feature: Infinite scroll / pagination

Browser: any browser

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:

  1. Go to any search results page (example: /search?q=buchet+mireasa)

  2. Scroll down until infinite scroll loads the next page

  3. 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.

Impact:

  • Poor user experience

  • Duplicate products displayed

  • Can confuse customers and affect conversion

Frequency:
100% reproducible

Hi,
Have you activated the theme? I have checked and cannot see the issue as you mentioned.

The theme is live. Screenshoot attached. You are liiking at the end of last page - please check the transition from page 1 to page 2 for example.

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:

{% assign products = search.results | where: 'object_type', 'product' %}

And replace it with this:

{% assign products_start_index = 0 %}
        {% if paginate.current_page > 1 %}
          {% assign products_start_index = products_per_page | divided_by: 4 %}
        {% endif %}
        {% assign products_end_index = products_per_page %}
        {% assign products = search.results | where: 'object_type', 'product' | slice: products_start_index, products_end_index %}

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.

Always a good idea to report theme bugs to theme developers and/or Shopify.

This worked perfectly. Thank you very much!

Hey,

This issue is likely a theme bug specific to the Horizon theme’s infinite scroll implementation on search results pages.

You should report this directly to the theme developer for a fix. They can provide an update or a patch for this duplication behavior.

Best,
Daniel Smith

Hi,

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.