How to change the add to cart to notify me when available on sunrise shopify theme?

New Member
1 0 0
Hi,

I need to know how to automatically change the add to cart button to Notify me when available once in stock and send an automated message to the customer that the item is available to purchase. I have included the product-loop.liquid code below.

{% comment %}
    Renders a product card using "Grid" style
    Accepts:
    - max_height: {Number} Maximum height of the product's image (required)
    - product: {Object} Product Liquid object (required)
    - show_vendor: {Boolean} Show the product's vendor depending on the section setting (optional)
    - show_sale: {Boolean} show sale sticker
    Usage:
    {% render 'product-loop', max_height: max_height, product: product, show_vendor: section.settings.show_vendor, show_sale:section.settings.show_sale_sticker %}
{% endcomment %}
<li>
  <a class="prod-th" href="{{ product.url | within:collection }}" title="{{ product.title | escape }}">
  
    {% render 'product-grid-image', img_id:product.featured_media.id, img:product.featured_media.preview_image, max_height: max_height %}

    <span class="product-title">
      {% if show_vendor %}<i class="th-vendor">{{product.vendor}}</i>{% endif %}
      <span class="title">
        {{ product.title | escape }}
               
      </span> 
      {% render 'product-price', product: product %} 
    </span>

    {% if product.compare_at_price > product.price %}
      {% if show_sale %}
        <span class="sale round">{{ 'products.general.sale' | t }}</span>
          {% endif %}
    {% endif %}
</a>
<form method="post" action="/cart/add">
    <input type="hidden" name="id" value="{{ product.variants.first.id }}" />
    <input type="Submit" value="{% if product.variants.first.available%}Add To Cart{% else %}Email Me{% endif%}" class="btn" {% unless product.variants.first.available %}disabled{% endunless %} />
    <input type="text" id="input-email" name="input-email" value="Enter your email here"/>
   <input type="submit" title="Notify Me" value="Notify Me">
  </form>
</li>

Thanks
0 Likes