Personalized checkout and custom promotions with Shopify Scripts
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:
<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>
Can anyone help me with this? Or if trigger on collection doesnt work, maybe trigger the pop-up on a certain product?
Thanks!
Solved! Go to the solution
This is an accepted solution.
{% 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.
This is an accepted solution.
{% 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.
Should I paste this code in collection.json or collection.list.json?
The theme is
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 %}
Okay, thanks!
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024