Hello! I need some help, I need to build a custom trigger on a Klaviyo pop-up which triggers on a certain collection called “Friteuze” when someone clicks on a product. Here’s the Klaviyo code:
Can anyone help me with this? Or if trigger on collection doesnt work, maybe trigger the pop-up on a certain product?
Thanks!
{% if collection.handle == "winter-sale" %}
<script type="text/javascript"> document.querySelector(".klaviyo_form_trigger").addEventListener('click',function (){ window._klOnsite = window._klOnsite || []; window._klOnsite.openForm('FormID', () => console.log("you triggered the form!")); });</script>
{% endif %}
Was my reply helpful? Please Like and Accept Solution. This mean a lot to me.
2 Likes
Should I paste this code in collection.json or collection.list.json?
I’m not aware of the theme. If you try and test it out.
{% if collection.handle == "winter-sale" %}
Add some text here - If this text is visible then on particular collection, then the code is working
{% endif %}