Back in Stock Notification showing even when product is in stock

Solved
New Member
4 0 0

I didn't code this myself but I've noticed the back in stock notification shows even if the product is in stock. A product-notify-me.liquid was added to my snippets section:

{% if settings.notify_me_form %}
<div class="notify_form" id="notify-form-{{ product.id }}" {% if product.available %}style="display:none"{% endif %}>
{% form 'contact' %}
{% if form.posted_successfully? %}
<p><em>Thanks! We will notify you when this product becomes available!</em></p>
{% elsif form.errors %}
<p><em>Please provide a valid email address.</em></p>
{% else %}
<p>
<label for="contact[email]">Notify me when this product is available:</label>

{% if customer %}
<input type="hidden" name="contact[email]" value="{{ customer.email }}" />
{% else %}
<input required type="email" name="contact[email]" id="contact[email]" placeholder="Enter your email address..." value="{{ contact.fields.email }}" style="display:inline;margin-bottom:0px" />
{% endif %}

<input type="hidden" name="contact[body]" value="Please notify me when {{ product.title | remove: '"' }} becomes available - {{ shop.url }}{{ product.url }}" />
<input class="submit" type="submit" value="Send" style="margin-bottom:0px" />
</p>
{% endif %}
{% endform %}
</div>
{% endif %}

 

And shows on the bottom of product page on desktop site and near the main photo (!) on the mobile site (which seems to be new as of this week) - does anyone know what may be wrong? web notification desktop.jpg

web notification mobile.jpg

0 Likes
Shopify Partner
852 86 130

You should check your product.liquid or product-template.liquid for where the snippet is referenced through an include, like {% include 'product-notify-me'%}, then check the logic around, there should be some conditionals that add or skip the include. Unless, the solution is JavaScript based and the logic to hide/show the prompt is running on front end.

 

Mind sharing the URL to your store?

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
New Member
4 0 0

Thank you so much for the help! I've found:

{% if template contains 'product' and product.available %}
<div id="sold-out">
{% form 'contact' %}
{% if form.posted_successfully? %}
<p class="accent-text">Thanks! We will notify you when this product becomes available!</p>
{% else %}
<p>Click <a id="notify-me" href="#"><strong>here</strong></a> to be notified by email when {{ product.title }} becomes available.</p>
{% endif %}

 

In the product.liquid file - not sure how to tell it to not show the form when product is unavailable. 

0 Likes
New Member
4 0 0

Success.

Astronaut
884 106 197

try adding an == false after product.available, it seems to me that this is saying "If you're on the product page, and if the product is available, show the form."

 

{% if template contains 'product' and product.available == false %}
<div id="sold-out">
{% form 'contact' %}
{% if form.posted_successfully? %}
<p class="accent-text">Thanks! We will notify you when this product becomes available!</p>
{% else %}
<p>Click <a id="notify-me" href="#"><strong>here</strong></a> to be notified by email when {{ product.title }} becomes available.</p>
{% endif %}
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 :D
0 Likes
Highlighted
New Member
4 0 0

This worked! Thank you!!

0 Likes