Solved

Set up back in stock via API

  • 5 September 2022
  • 2 replies
  • 476 views

Badge +2

Hey,
 

I want to set up the back in stock functionality via API for Shopify. I was following this this guide but I am facing an issue with CORS policy:

Access to fetch at 'https://a.klaviyo.com/api/v1/catalog/subscribe' from origin 'https://blabla.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

If I got it right, the issue is that the klaviyo domain is not passing Access-Control-Allow-Origin' header in the response. Do you have an idea how to fix that?

And what is the difference between https://manage.kmail-lists.com/ajax/subscriptions/subscribe and https://a.klaviyo.com/api/v1/catalog/subscribe ?

Many Thanks,
Tristan

icon

Best answer by THahn 21 September 2022, 20:25

View original

2 replies

Userlevel 7
Badge +60

Hi there @THahn

 

Thanks for sharing your question with us! 

 

So the first endpoint you link is the subscription endpoint that we provide to customers who want to build their own custom signup form and the other endpoint is the call that adds users to a specific list and what our BIS documents reference. 

 

There are other users who have had similar CORS issues come up as they’re installing back in stock as well. I’d recommend investigating these threads to gain more insight. However, if you still haven’t found an answer I’d suggest reaching out to our awesome support team .

 

Thanks for participating in the Community!

-Taylor 

Badge +2

Hey,

thanks for the answer but it didn’t work in my scenario. Seems like CORS where not the root cause of the issue.
 

I solved the issue using an ajax call as described here:
https://developers.klaviyo.com/en/docs/how-to-enable-back-in-stock-for-custom-catalog-feeds#front-end-request

 

Reply