2

I have noticed that on my infinite scroll the swatches are not showing for products loaded over ajax.

I'm guessing that similar to ajax add to cart buttons needing to be initialised the swatch renderer also needs to initialise these new products once they are loaded however unsure how this can be achieved?

  • This should be the default behaviour, the mage.js file should initialise these components when the body content is updated. How are you inserting the new HTML? – Javier Villanueva Sep 19 '18 at 13:20
  • Thanks for your reply. It's fine now i used the content trigger('contentUpdated') to fix the issue. Previously this didn't work for the ajax add to cart buttons and had to use $("form[data-role='tocart-form']").catalogAddToCart(); instead but using both works for both swatches and addtocart. – harri Sep 19 '18 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.