Skip to main content
Contributor I
April 19, 2022
Solved

I'm setting up a headless shopify store and trying to get back in stock notifications working, but I'm having some trouble

  • April 19, 2022
  • 3 replies
  • 680 views

My fetch request looks like this

fetch(`https://a.klaviyo.com/api/v1/catalog/subscribe`, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({
a: process.env.NEXT_PUBLIC_KLAVIYO_KEY,
email: email,
variant: properties.variantId,
platform: 'shopify'
})
})

but the issue is that my shopify variant Ids are alphanumeric and this endpoint is requiring the integer ID that comes from my klaviyo catalog, and I’m a bit stuck on how to get this working properly.

 

Any info would be great, thanks!

This topic has been closed for replies.
Best answer by Taylor Tarpley

Hi there @logansparlin

 

Welcome to the Community! Thanks for sharing your question with us! 

 

Unfortunately, the headless Shopify theme is not listed as a supported theme in Shopify for back in stock and the Klaviyo team therefore can’t help you troubleshoot this issue. However, I would reach out to one of our awesome Klaviyo partners who would love to help get this set up for you! 

 

Thanks for participating in the Community!

-Taylor 

3 replies

Taylor Tarpley
Community Manager
Community Manager
April 19, 2022

Hi there @logansparlin

 

Welcome to the Community! Thanks for sharing your question with us! 

 

Unfortunately, the headless Shopify theme is not listed as a supported theme in Shopify for back in stock and the Klaviyo team therefore can’t help you troubleshoot this issue. However, I would reach out to one of our awesome Klaviyo partners who would love to help get this set up for you! 

 

Thanks for participating in the Community!

-Taylor 

Contributor I
April 19, 2022

Hi Taylor, thanks for the response! I’ll reach out to one of the Klaviyo partners and see what I can figure out. Happy to be a part of the community!

Contributor I
April 20, 2022

Solved my own problem, turns out I just had to decode the alphanumeric variant ID coming from the Shopify GraphQL API using the following code so that the variant Id is the correct format for the API

Buffer(variantId, 'base64').toString('binary').replace(/\D+/g, '')