Solved

Custom Shopify Back in Stock + Subscribe to List API

  • 16 March 2022
  • 2 replies
  • 440 views

Badge +2

Hello! While reading the community forum and developer docs, I got the impression that API calls are possible using regular JS, but anytime I try to request something I get CORS error and that is the end of it. I tried both public and private API keys, AJAX and fetch(), configured the list to be single opt-in and double opt-in. Even used the provided JS script in the docs and used my private email for testing and still it does not work. Is it even possible to do that right now and what am I doing wrong? Here are the links I used for reference: for the list subscription https://developers.klaviyo.com/en/reference/subscribe, and for Back in Stock I found this from one of the accepted answers:

This does not work for me, so If you have any idea why lemme know. Thanks!

icon

Best answer by stephen.trumble 17 March 2022, 11:11

View original

2 replies

Badge +2

Hey @stephen.trumble! Thanks for reaching out, I guess my dilemma is how to translate this curl request to javascript one: curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=AccountID&email=test@klaviyo.com&variant=5000149172256&platform=shopify'

Userlevel 7
Badge +60

Hey @NemoK 

Thank you so much for asking the Klaviyo Community for help!

The article you linked above is to add users to a subscriber list but it looks like you are trying to create a custom back in stock event while subscribing users to a list? You will need the link the already mentioned with the document I added to build this out! Happy building!

Reply