Help - Integrating a Klaviyo flow with a Pagefly product page

Highlighted
New Member
3 0 1

Hello Shopify community,

I am trying to integrate a "Back in Stock" Klaviyo Flow into my site.  My product pages are built in PageFly and are having trouble connecting with the script that Klaviyo is asking me to put into the theme.liquid file.  I tried to add this script to a HTML box that I created on my PageFly product page...this did not work,  Any thoughts?

Script Klaviyo is asking me to put in the theme.liquid file...

<script src="https://a.klaviyo.com/media/js/onsite/onsite.js"></script>
<script>
    var klaviyo = klaviyo || [];
    klaviyo.init({
      account: "PUBLIC_API_KEY",
      platform: "shopify"
    });
    klaviyo.enable("backinstock",{ 
    trigger: {
      product_page_text: "Notify Me When Available",
      product_page_class: "btn",
      product_page_text_align: "center",
      product_page_margin: "0px",
      replace_anchor: false
    },
    modal: {
     headline: "{product_name}",
     body_content: "Register to receive a notification when this item comes back in stock.",
     email_field_label: "Email",
     button_label: "Notify me when available",
     subscription_success_label: "You're in! We'll let you know when it's back.",
     footer_content: '',
     additional_styles: "@import url('https://fonts.googleapis.com/css?family=Helvetica+Neue');",
     drop_background_color: "#000",
     background_color: "#fff",
     text_color: "#222",
     button_text_color: "#fff",
     button_background_color: "#439fdb",
     close_button_color: "#ccc",
     error_background_color: "#fcd6d7",
     error_text_color: "#C72E2F",
     success_background_color: "#d3efcd",
     success_text_color: "#1B9500"
    }
  });
</script>
1 Like
Highlighted

Hard to debug without seeing the page, but I think PageFly has a place where you can enter scripts for the page, or globally for the site, that might work.

Also, for the Klaviyo script to work it needs to be able to find the "Add to cart" button, so if your button disappears completely when your product is out of stock, it won't work. A workaround for that is to add a variant option that says something like "Select Size..." and put the inventory to 1 on it.

Hope that helps.

0 Likes