Recently, I have been trying to set up email marketing flows, specifically the Abandoned Cart Reminder and the Back in Stock flow for my store and have been having issues with the putting the coding snippets into my store. It may be because that we have a custom Shopify theme but, when following the instructions for the installation of the added to cart metric I have been unsuccessful in finding the proper button code for my store.
Would be greatly appreciated if someone could potentially point me in the right direction on how I can get this working!
Thanks in advance.
Best answer by DovView original
Thanks for sharing your question with the Klaviyo Community.
Since your button uses “class” notation and contains multiple classes, you should be following the instructions outlined here.
In short, you will have to replace the “add-to-cart” portion of the below snippet (which is already pasted in your Shopify product.liquid file) with the classes present in your button, separated by spaces. As you can see from the page inspection, those classes are “btn btn--full add-to-cart spo-container”. This is what that portion of the snippet looks like now:
With the updates that portion of the code will look like the following:
Once you make this update and save. You will have to add an item to your cart from a cookied browser. That is, a browser that has previously filled a Klaviyo sign-up form or clicked through a Klaviyo email. Alternatively, you can cookie yourself through self-identifying the browser first and then add an item to your cart.
Thanks and have a wonderful day.
Thank you for the reply, after updating the code snippet with the new button name just like you had instructed, it still is not registering with Klaviyo that it is installed properly for the abandoned cart reminder flow.
Any thoughts on what I should do now?
Thanks for your reply.
The “This flow require setting up Added to Cart metric” notice won’t disappear instantly after adding Added to Cart metric, it takes some time before Klaviyo “recognizes” Added to Cart in that modal since you just installed it, so I wouldn’t be overly concerned with that. Your best off checking the Analytics tab under Metrics to see if Added to Cart is showing up there as a discrete metric. If so, you’re good to go -- just create a net-new metric-triggered flow off of Added to Cart. If you do not see Added to Cart under Metrics, there are a couple of other things to check:
I hope this helps! Please do let us know if you’re still having trouble after this.
I am unable to find the location to paste the code for class notation. When i go to my prodcut.liquid this is what i see. i current have the turbo theme page. Can someone please help. i contacted Klaviyo and they are unable to help
WHen i go to the product-template. There isnt a “Script”
This is my site with inspect
i was able to paste the script but it does not appear to trigger on Klaviyo. i even changed the “-” to “_” but it didnt work
Thanks for sharing this information with the Community.
Since your button uses both id and class, I recommend trying to use the class notation snippet and using “add_to_cart” in that snippet. If that does not work, I would try including the first two classes, “action_button” and “add_to_cart” in the snippet (separated by spaces), followed by using all 3 classes contained under class, separated by spaces in the snippet. See the code snippet below for an example of what it would look like with all 3 classes included. From there, you will need to cookie your browser to log the “Added to Cart” event. I recommend reviewing the best answer in the thread below for more information on that portion of the solution since there are other pre-requisites in order to successfully log the “Added to Cart” event.
Thank you DD, i tested these and tried adding to cart to trigger the event but it didnt work either. Will you like me to send you my site directly to review the code i have in?
Since none of the above worked out for you, I recommend contacting our support team to have a closer look at your site. Thank you for your understanding.