Skip to main content
Contributor I
November 11, 2024

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

  • November 11, 2024
  • 3 replies
  • 786 views

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!

    This topic has been closed for replies.

    3 replies

    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

    Contributor I
    November 22, 2024

    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!

    Klaviyo Employee
    November 22, 2024

    Great to hear!