Skip to main content

Trigger Klaviyo "Back in Stock" button programmatically on Shopify product page

  • November 11, 2024
  • 3 replies
  • 390 views

Forum|alt.badge.img+1

I’ve gotten the Notify Me When Available button to work on Shopify product pages, but I need to trigger this button programmatically when a particular URL parameter is passed in. So far, I have tried 

$('.klaviyo-bis-trigger').trigger('click');
$('.klaviyo-bis-trigger').trigger('change');
$('.klaviyo-bis-trigger').click();

To no avail. How can I programmatically click this button?

Thanks!

3 replies

Forum|alt.badge.img+7
  • Klaviyo Employee
  • November 18, 2024

I wonder if the issue is the anchor link hasn’t rendered yet from the klaviyo JavaScript before your code loads.

 

You could also try directly calling the Create Client Back In Stock Subscription API: https://developers.klaviyo.com/en/reference/create_client_back_in_stock_subscription


Forum|alt.badge.img+1

Thank you so much for your help. Thanks to your comment, I did end up writing a custom JavaScript module that tapped into the client side of that API endpoint and pushed subscriptions manually. Job done!


Forum|alt.badge.img+7
  • Klaviyo Employee
  • November 22, 2024

Great to hear!