Magento 2 Load More Product Script

As Dava Gordon has suggested i have been using the https://github.com/Strategery-Inc/Magento2-InfiniteScroll which does work however has the problem you are witnessing with ajax add to cart breaking after load.

This seems to be an issue with the x-magento-init scripts that run on page load and therefore do not run on ajax requests. To fix this issue however i recommend adding a single line of code to:

Strategery/Infinitescroll/view/frontend/web/js/infinitescroll.js

$("form[data-role='tocart-form']").catalogAddToCart();

This goes at about line 91 so the on rendered event updates the magento add to cart forms to allow for ajax add to cart.

Section of code should therefore be updated to look like below:

window.ias.on('rendered', function(items){
                SgyIAS._log({eventName: 'render', items: items});
                $("form[data-role='tocart-form']").catalogAddToCart();
            });

I have also created a pull request on the github page for this issue and fix so can also be seen on there now.


This module is not worth supporting can i recommend you use https://github.com/Strategery-Inc/Magento2-InfiniteScroll which does work