-
-
Save carolineschnapp/0156b3a5f0c872d752ff to your computer and use it in GitHub Desktop.
Notify me when a product that is sold out becomes available (using a contact form)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% unless 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 %} | |
{% if form.errors %} | |
<div class="error feedback accent-text"> | |
<p>Please provide a valid email address.</p> | |
</div> | |
{% endif %} | |
{% unless form.posted_successfully? %} | |
<div id="notify-me-wrapper" class="clearfix" style="display:none"> | |
{% if customer %} | |
<input type="hidden" name="contact[email]" value="{{ customer.email }}" /> | |
{% else %} | |
<input style="float:left; width:180px;" required="required" type="email" name="contact[email]" placeholder="your@email.com" class="styled-input{% if form.errors contains 'email' %} error{% endif %}" value="{{ contact.fields.email }}" /> | |
{% endif %} | |
<input type="hidden" name="contact[body]" value="Please notify me when {{ product.title | escape }} becomes available." /> | |
<input style="float:left; margin-left:5px;" class="btn styled-submit" type="submit" value="Send" /> | |
</div> | |
{% endunless %} | |
<script> | |
jQuery('#notify-me').click(function() { | |
{% if customer %} | |
jQuery('#sold-out form').submit(); | |
{% else %} | |
jQuery('#notify-me-wrapper').fadeIn(); | |
{% endif %} | |
return false; | |
} ); | |
</script> | |
{% endform %} | |
</div> | |
{% endunless %} |
Hi Caroline - please can you advise on how to edit the code (if possible), so the sign up (notify me) button is automatically shown, to save the customer from having to "click here"? Thnx.
@Uberstar did you ever figure out how to do this? I also want to have it shown automatically.
@carolineschnapp Also I would like to embed a Mailchimp code so every email that signs up for out of stock items populate in a list so automation is easy. Is this possible?
thank you buddie
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Caroline,
Just want to ask. On how to add information hidden value product variants (i.e) size and color.
Thanks,
Kind regards,
Jaro