Forms - Add a back in stock notification form

relledge98
New Member
7 0 0

I am using Testament theme and unable to find code in product-template.liquid any advice?

0 Likes
Quondy
Excursionist
37 0 5

Hello @TyW ,

 

I have tried to follow up the instructions of the tutorial but I am stuck at the first instruction. I have been trying to find the HTML but it does not work for the Debut theme. I have installed Debut theme in March 2020.

 

Please, since there are other users with my same problem, can you please share an updated version of the "Notify Me Form" that works with Liquid code?

 

Thank you

 

 

0 Likes
mctenold
Shopify Partner
42 0 6

For clarity everyone, this just basically adds a contact form to the product page if the product is out of stock. This does NOT send any automatic notification emails to the customer once an item is back in stock.

shoptstarrbouti
New Member
3 0 0

Hi , the instructions were not clear. Can you assist me with this please ? 

0 Likes
shoptstarrbouti
New Member
3 0 0

Hi , the instructions were not clear. Can you assist me with this please ? 

0 Likes
thewoobles
New Member
4 0 0

I put the if / end if around this part of my Debut Shopify code and it worked:

{% if product.available %}

{% capture "form_classes" -%}
product-form product-form-{{ section.id }}
{%- unless section.settings.show_variant_labels %} product-form--hide-variant-labels {% endunless %}
{%- if section.settings.enable_payment_button and product.has_only_default_variant %} product-form--payment-button-no-variants {%- endif -%}
{%- if current_variant.available == false %} product-form--variant-sold-out {%- endif -%}
{%- endcapture %}


{% form 'product', product, class:form_classes, novalidate: 'novalidate', data-product-form: '' %}
{% unless product.has_only_default_variant %}
<div class="product-form__controls-group">
{% for option in product.options_with_values %}
<div class="selector-wrapper js product-form__item">
<label {% if option.name == 'default' %}class="label--hidden" {% endif %}for="SingleOptionSelector-{{ forloop.index0 }}">
{{ option.name }}
</label>
<select class="single-option-selector single-option-selector-{{ section.id }} product-form__input"
id="SingleOptionSelector-{{ forloop.index0 }}"
data-index="option{{ forloop.index }}"
>
{% for value in option.values %}
<option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
{% endfor %}
</select>
</div>
{% endfor %}
</div>
{% endunless %}


<select name="id" id="ProductSelect-{{ section.id }}" class="product-form__variants no-js">
{% for variant in product.variants %}
<option value="{{ variant.id }}"
{%- if variant == current_variant %} selected="selected" {%- endif -%}
>
{{ variant.title }} {%- if variant.available == false %} - {{ 'products.product.sold_out' | t }}{% endif %}
</option>
{% endfor %}
</select>

{% if section.settings.show_quantity_selector %}
<div class="product-form__controls-group">
<div class="product-form__item">
<label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label>
<input type="number" id="Quantity-{{ section.id }}"
name="quantity" value="1" min="1" pattern="[0-9]*"
class="product-form__input product-form__input--quantity" data-quantity-input
>
</div>
</div>
{% endif %}

<div class="product-form__error-message-wrapper product-form__error-message-wrapper--hidden{% if section.settings.enable_payment_button %} product-form__error-message-wrapper--has-payment-button{% endif %}"
data-error-message-wrapper
role="alert"
>
<span class="visually-hidden">{{ 'general.accessibility.error' | t }} </span>
{% include 'icon-error' %}
<span class="product-form__error-message" data-error-message>{{ 'products.product.quantity_minimum_message' | t }}</span>
</div>

<div class="product-form__controls-group product-form__controls-group--submit">
<div class="product-form__item product-form__item--submit
{%- if section.settings.enable_payment_button %} product-form__item--payment-button {%- endif -%}
{%- if product.has_only_default_variant %} product-form__item--no-variants {%- endif -%}"
>
<button type="submit" name="add"
{% unless current_variant.available %} aria-disabled="true"{% endunless %}
aria-label="{% unless current_variant.available %}{{ 'products.product.sold_out' | t }}{% else %}{{ 'products.product.add_to_cart' | t }}{% endunless %}"
class="btn product-form__cart-submit{% if section.settings.enable_payment_button %} btn--secondary-accent{% endif %}"
{% if settings.enable_ajax %}aria-haspopup="dialog"{% endif %}
data-add-to-cart>
<span data-add-to-cart-text>
{% unless current_variant.available %}
{{ 'products.product.sold_out' | t }}
{% else %}
{{ 'products.product.add_to_cart' | t }}
{% endunless %}
</span>
<span class="hide" data-loader>
{% include 'icon-spinner' %}
</span>
</button>
{% if section.settings.enable_payment_button %}
{{ form | payment_button }}
{% endif %}
</div>
</div>
{% endform %}
</div>

{% endif %}

0 Likes
thewoobles
New Member
4 0 0

I have multiple items that are out of stock. Is there a way to modify the automatically generated email so that I know which item the customer signed up for a notification for?

0 Likes
charu_15
New Member
1 0 0

It is working but I am not receiving any emails from Shopify when the product is in stock.

0 Likes
lynda
New Member
2 0 0

Your code worked great for me. Thank you so much for sharing!!! I got the text to appear "Click here to be notified..." but not the email form. Any advice would be greatly appreciated.

0 Likes
StudioSicily
New Member
1 0 0

Same problem here, could anyone help?

0 Likes