Hide "Notify When Available" button when product is in stock

Topic summary

A user implemented Klaviyo’s out-of-stock notification integration for Shopify but encountered an issue where the “Notify When Available” button displays on all products, including those currently in stock.

Proposed Solution:

  • Wrap the button code with a conditional statement that checks product availability
  • Display the default “Add to Cart” button when products are in stock
  • Show the notification button only when products are out of stock
  • For variant products, add logic to check variant-level availability and update the button display when variants change

Current Status:
The original poster requested assistance implementing the solution. One responder offered to help via email for further discussion. Another user followed up to check if the issue was resolved, but no confirmation has been provided yet.

Summarized with AI on November 20. AI used: claude-sonnet-4-5-20250929.

I’ve added custom code for the klayvio/shopify out of stock integration but now the button is showing on all products - not just out of stock products. How do I hide the button when the products are in stock?

www.studio-n.com.au

Hello @marjoriebaldwin ,

First wrap it with the condition ( If product available then add to cart button else notify button )
Second with variant products on change of the variant check the availability of the variant products. If available keep the default button else display notify button.

Thanks

1 Like

Hi, can you do it for me?

Yes, you can share the details through email for further discussions.

Hello @marjoriebaldwin

Is this issue resolved ?