Shopify: adding an action on render

It might sometimes be useful for you to apply some custom code on the content that we render.
To do so, you can modify our code, but keeping this logic separated can sometimes be more intuitive.

Rendering

Since Algolia renders at every keystroke, changes to our DOM need to be done at every re-render.
The next sections describe how to do so both for our autocomplete and instantsearch.

Autocomplete

algoliaShopify.autocomplete.$input.on('autocomplete:updated', function () {
  console.log('Autocomplete redrawn');
});

Instant search

algoliaShopify.instantsearch.search.on('render', function () {
  console.log('Instant search redrawn');
});
1 Like

Thanks jerska,

this was useful for me

1 Like

Thank you for this. I find that the “render” method runs multiple times per render. Is there a “complete” method that only runs once, after all widgets and hits load?