Solved

Custom Back in Stock form (Shopify)


Badge +2

The Back in Stock implementation for Shopify (described here: https://help.klaviyo.com/hc/en-us/articles/360001895651-How-to-Install-Back-in-Stock-for-Shopify) doesn’t provide us with the level of customization that we would like to have. As such we are looking at implementing a custom Back in Stock form either via a legacy form method (similar to https://help.klaviyo.com/hc/en-us/articles/115005249588-How-to-Add-and-Customize-a-Legacy-Embedded-Signup-Form) or via a custom form and API request in the frontend (in JS).

This developer documentation for the API https://help.klaviyo.com/hc/en-us/articles/360006565332-Back-in-Stock-for-Mobile-App-Developers while not explicitly stated I believe is only for server side API calls as CORS blocks POST requests via JS.

Can anyone point me in the right direction here - add a user to back in stock list for a product via a custom form on the frontend, without need for server-side api calls. (or if there is no right direction - let me know!)

Many thanks!

Olly

icon

Best answer by julie.accardo 14 March 2021, 14:12

View original

10 replies

Userlevel 5
Badge +34

Hi @OllyWalker,

 

You do have the ability to make a front end API call to our Back in Stock endpoint. Below are a few screenshots from a PDF that we send to customers that are looking to set up a custom catalog. The only thing I am not 100% sure about would be whether you would need to set up a custom catalog or if you are good to pull the above data from the Shopify catalog. 

 

Figured I’d give you a starting point!

 

Hope this helps!

Julie

Badge +2

A quick note on this from a recent customer resolution:

The “platform” should be set according to the catalog source. If you are using a custom catalog, the platform should be set to “api.” However, if you are using this process with Shopify’s catalog included with the Shopify integration, then the platform should be set to “shopify”

 

 

Badge +2

A quick follow up question regarding this. Would there be a way to send a back in stock subscription with javascript using a customers phone number? I.e. ideally something like:
 

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=AccountID&phone_number=4016882039&variant=5000149172256&platform=shopify'

If that’s not possible, perhaps there’s a way to mock the subscription via the identify API. I.e. that is like

{
"token": "PUBLIC_KEY",
"event": "Subscribed to Back in Stock",
"customer_properties": {
"$phone_number": "+13239169023"
},
"properties": {
... whatever BIS expects
}
}

then POST this json to 

https://a.klaviyo.com/api/track

@BenPE 

Userlevel 7
Badge +60

Hello @Steven P,

Great question!

At this time the back in stock functionality does not support subscribing users via a Phone Number. Thus attempting to identify a user with a phone number will not work as Klaviyo will will rely on using an email address to identify its users and subscribers to back in stock. 

However, I am aware that our Product Team is working hard towards including this functionality of allowing users to subscribe to back in stock with a phone number. I’ll share your feedback to the team for more details. When this feature does become available, i’ll be sure to follow up in this thread so other Community members who may be following along can receive an update as well. 

Thanks for being a member of the Klaviyo Community!

David

Badge +4

@david.to Thanks a ton for following up on this, and sharing this request with the Product Team! Any estimate on when this feature would be added?

And It’s a pleasure to be a part of the Klaviyo Community.

Userlevel 7
Badge +60

Hey @Steven Petteruti,

At this time we currently do not have any estimation on when this feature will be available. But, with the growing interest in Klaviyo’s SMS services I would suspect it would be sometime in the near future as Klaviyo expands its SMS capabilities.

David

Badge +2

Awesome David, thank you! I may have found a workaround though in case you were curious.


We can fetch the customer’s email from their phone number via the Klaviyo `/identify` endpoint, and then pass the email into the backInStock endpoint. That would at least work for any SMS subscribers that already are in Klaviyo.

Badge +1

“You do have the ability to make a front end API call to our Back in Stock endpoint.” => this should be mentioned in the docs… So what are you recommending how to call your API point? Do we need to create a Shopify App just for that?

Badge

Hi, is this still working?

Can I run bellow script in my website. and add item to back in stock for custom use? 

$.ajax({
    type: "POST",
        ur: "https://a.klaviyo.com/onsite/components/back-in-stock/subscribe",
        data: {
        a: "xxxxxx",
        email: "xxxx@gmail.com",
        variant: "55005964218416",
        platform: "shopify"
    },
    success: function(response){
        console.log(response)
    }
    })

When I run this script in chrome dev tool (with actual data) it returns 404 (Not Found), what is the issue?

Badge

Hey @Steven Petteruti,

At this time we currently do not have any estimation on when this feature will be available. But, with the growing interest in Klaviyo’s SMS services I would suspect it would be sometime in the near future as Klaviyo expands its SMS capabilities.

David

 

Has this feature request been addressed?

Reply