Solved

[ SHOPIFY ] Pop up activates based on custom trigger such as $ in cart

  • 14 October 2022
  • 3 replies
  • 393 views

Badge +1

Has anyone built a Klaviyo Custom Trigger for a pop-up to appear based on the value of the cart? Or anything similar?

icon

Best answer by alex.hong 14 October 2022, 22:58

View original

3 replies

Userlevel 7
Badge +58

Hi there @Aves3888 ,

Thanks for sharing to the Community. 

At this time, Klaviyo does not have a way to trigger a form based on the amount that a customer has in their cart. We can trigger the form to show on a cart page, but that would trigger for everyone regardless of what they have in their cart. That being said, this is a great idea and I will happily pass this along to our product team! 
 
You can further target your forms to give browsers a personalized onsite experience based on their data within Klaviyo. You absolutely can target your form to display only to certain people using the below criteria (you would just need to make sure the "show to all visitors" button is checked): 
 
targeting_options.jpeg
 
The following article has some great information on targeting and behavior settings if you're looking to dig a little deeper.

Badge +1

Yes, I was hoping to use this feature to build out a trigger: https://developers.klaviyo.com/en/docs/how-to-custom-trigger-a-popup-or-flyout-form

Badge

Yes, I was hoping to use this feature to build out a trigger: https://developers.klaviyo.com/en/docs/how-to-custom-trigger-a-popup-or-flyout-form

Hey I just figured out how to do this myself and wanted to let you know my solution in case you were still needing it. I have the Klaviyo popup set to only show on custom trigger like you suggested. And then in Shopify Theme → Edit Code, navigate to the theme.liquid file. Then underneath the <body> tag  (will work other places as well, just where I have mine), add the following code:

{% if cart.total_price > 5000 %}
    <script type="text/javascript">
      window._klOnsite = window._klOnsite || [];
      window._klOnsite.push(['openForm', 'FORM_ID’]);
    </script>
{% endif %}

 

You will need to update the number based on the cart total you want to show it at. Shopify’s number here is in cents so 5000 = $50. So say you want it to show at $25, then the line would be {% if cart.total_price > 2500 %}. And then you also need to add your FORM_ID. The two ‘window’ lines can be copy/pasted from your editting screen as well.

 

Best of luck!

Reply