Solved

Problem installing Back in Stock script on Shopify Icon theme (TypeError: klaviyo.init is not a function)

  • 29 September 2021
  • 1 reply
  • 729 views

Badge +1
  • Contributor I
  • 0 replies

I’ve been trying to installing the Back in Stock feature on a Shopify store using the Icon theme according to the guide the documentation, but can’t get it to work. I did do this for other Shopify stores in the past, so I’m familiar with process, but this time I’m running into errors that I find hard to interpret.

The button doesn’t show up (and when I add a link with the “klaviyo-bis-trigger” class manually the popup doesn’t open). So I checked the browser console and found it saying:

TypeError: klaviyo.init is not a function

 

I’m not entirely sure what to make of this.

My first suspicion was that it might steam from the order in which things are loaded, but I do load the onsite.js file first and there seems to be nothing else required.

 

Does anyone know where this issue might be coming from?

Thanks!

icon

Best answer by David To 30 September 2021, 22:03

View original

1 reply

Userlevel 7
Badge +60

Hello @dt21,

Thanks for sharing your question with the Klaviyo Community!

Since it sounds like you are using the Icon theme, which is not one of the free basic Shopify theme that innately supports Klaviyo’s back in stock functionality, some additional adjustments and customizations may be needed for the Klaviyo back in stock code to function correctly. A list of basic Shopify themes that support the Klaviyo back in stock feature out of the box can be found in the Back in Stock Styling Code Snippets for Free Shopify Themes Help Center article.

Because this theme is a custom/third-party one, theme developers are not required to follow some basic guidelines that allow our back-in-stock feature to function as intended. 

This does not mean you would not be able to incorporate or use the Klaviyo back in stock feature for this custom theme though. In order to use this function, some additional adjustments to the code may be required to align with the Icon Shopify theme. Sometimes the theme developer will be able to help with this implementation or you can reach out to one of our approved Klaviyo partner who can further assist you in making these edits. 

Other Community post that touch upon this subject that may be of use can be found below:

If you end up working with a developer, you also have the option to build a fully customized solution. Our Back In Stock feature works by sending an event metric into Klaviyo which triggers a flow. You just need to send the Variant ID, Product ID, and email address. All of this can be custom-built using our open API to work with your website. Some documentation that may be useful in understanding this can be found in the Shopify Back in Stock for Developers article.

Otherwise, there are other back-in-stock solutions supported through Shopify that you can find through their apps section. Here is a link to their site: https://apps.shopify.com/search?q=back+in+stock

I hope this helps!

David

Reply