Klaviyo Notify Button in place of Add-to-cart

Klaviyo Notify Button in place of Add-to-cart

INFRA
Shopify Partner
252 2 90

Hi there,

 

I would like to have the "notify me when in stock' button in place of the add to cart, when the stock is 0 on this product template.

 

Screenshot 2025-06-10 at 16.52.07.png

 

How can I best achieve this?

Website (size XL is sold out)

 

thanks!

Replies 2 (2)

shahrozbabar5
Shopify Partner
343 28 34

@INFRA 

You can absolutely achieve this by conditionally hiding the Add to Cart button and showing a "Notify me when available" button when the product is out of stock.

Here’s a general method using Shopify Liquid:

🔧 Steps (Product Template):

  1. Go to Online Store > Themes > Edit code.

  2. Open your main-product.liquid or product-form.liquid (varies by theme).

  3. Locate the section where the "Add to cart" button is.

  4. Replace it with this logic:

{% if product.available %}
  <button type="submit" class="product-form__submit button button--full-width">
    {{ 'products.product.add_to_cart' | t }}
  </button>
{% else %}
  <button type="button" class="button button--full-width notify-me-btn">
    Notify me when available
  </button>
{% endif %}

Optional: You can link this button to a [Back in Stock] app like Shopify’s "Back in Stock Notifications", Klaviyo, or Appikon to make it functional.


I'll fix this at no cost and ensure it's styled perfectly — just share your store URL and theme name/code access.

Need a Shopify Expert and Specialist? Let's chat on WhatsApp +923046983349 and bring your vision to life!


Custom Shopify Store Design | Premium Themes | Variant Apps Expert


Your Coffee Tip a seamless synergy. ❤️

Ninthony
Shopify Partner
2354 355 1050

You shouldn't need to so much coding yourself here, Klaviyo has an option in the javascript it had you paste for "replace_anchor" -- you should be able to set that to true:

Ninthony_0-1749592534025.png

Ninthony_1-1749592571665.png

 

 

If my solution helped you, please like it and accept it as the solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish 😄