Skip to content

Instantly share code, notes, and snippets.

View msmithstubbs's full-sized avatar

Matt Stubbs msmithstubbs

View GitHub Profile
@msmithstubbs
msmithstubbs / gist:7895197
Created December 10, 2013 18:09
Ttile from variant dropdowns
var title = $('#productVariants .single-option-selector').map(function() { return $(this).val() }).get().join(' / ');
@msmithstubbs
msmithstubbs / product-notify-me.liquid
Last active January 3, 2016 13:39
Catch blank phone field
{% if settings.notify_me_form %}
<div class="notify_form" id="notify-form-{{ product.id }}" {% if product.available %}style="display:none"{% endif %}>
<form action="/contact" method="post" data-first-variant="{{product.variants.first.id}}" id="BIS_form" onsubmit="return createNotification{{product.id}}(this); return false;">
<p>
<label for="contact[email]"><strong>Contact me with stock price and availability:</strong></label>
</p>
<p>
<input required type="phone" name="contact[email]" id="contact[email]" placeholder="EMAIL" value="{{ contact.fields.email }}" style="display:inline;margin-bottom:0px" />
</p>
<p>
@msmithstubbs
msmithstubbs / variant-images.liquid
Created February 12, 2014 14:29
Match image in the email template to the variant.
{% comment %}
This looks for an image with the same alt text as the variant title.
You can use this if your are matching variants to images using the image ALT text.
{% endcomment %}
{% assign main_image = product.featured_image %}
{% for image in product.images %}
{% if image.alt == variant.title %}
@msmithstubbs
msmithstubbs / form
Created March 14, 2014 09:03
Example of Back In Stock form with MailChimp checkbox
<label>Email me when available</label>
<input type="email" id="notify_email" />
<input type="checkbox" id="notify_opt_in" value="Yes" /> Opt-in in for
email newsletter
<button id="notify_button">Email when available</button>
<script>
var notificationCallback = function(data) {
var msg = '';
if (data.status == 'OK') {
@msmithstubbs
msmithstubbs / gist:9546263
Last active August 29, 2015 13:57
Show button for a single collection
{% for collection in product.collections %} {% if collection.handle == 'spring-summer-14' %} <script> _BISConfig = { button: { visible: true } }; </script> {% endif %} {% endfor %}
@msmithstubbs
msmithstubbs / gist:9617039
Last active August 29, 2015 13:57
Update form label with variant title
$(function() {
$(document).on('change', '.single-option-selector', function() {
var label = $('.notify_form label[for^=contact]');
if (label.is(':visible')) {
var title = $('.single-option-selector').map(function() { return $(this).val() }).get().join(' ');
label.text("Notify me when the " + title + " are in stock");
}
});
@msmithstubbs
msmithstubbs / bis-notify-me-js.liquid
Last active August 29, 2015 13:57
Back In Stock Inline for for Symmetry theme
<script>
/* Back In Stock app */
$(function() {
function createNotification(e) {
var $productContainer = $(e.target).closest('div[data-product-id], #main-product-detail'),
productId = $(e.target).data('product-id'),
email = $productContainer.find('[name=BIS_email]').val(),
variantId;
@msmithstubbs
msmithstubbs / gist:10281884
Created April 9, 2014 15:15
Hide the Back In Stock Notify Me button on mobile devices.
@media only screen and (max-width: 320px) {
body > div#BIS_trigger { display: none !important; }
}
@msmithstubbs
msmithstubbs / keys.txt
Created April 14, 2014 16:12
Environemnt bootstrap
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2WCRvFexNsG1TDZvf4jOFxSC1ZFQuZCr3Suu3dYBZ5Ao7G6cKNHvz2l+FwbOWLlnEspywLpk2bbTRHUOM2AKLJ5JmSlrLZXf49TAs64JooLPl9X5gMsetXpasv7DJpl516UbtAbfY7AlQGzYkj+tCuelF5s8H25XUMfz/2/IFUk8OdND5FHLUJ0FUPk1A2iy3CiQ3irmO3Jw48cm6qKVUaDOhmVavGHuzg7C4psTI2X9Mi2kmwyu7CiK2E8RbNhK7razj4yaHsqyrMflWbonhU0WT+jjSJk/taWUkDM+5Yv7m8emcAA1J+daWiIkTNpPPVDDrkReoIzW0lqgDY+KLw== matt@shiraz.lan
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNb6mkpmDRDffOecoswXbFYA4Gq/iyCgd9eDsVznzgh3f/Hd5f3MIoh88NbLqI75vUuqr7gNmkRRmnon0clxTmKAZUrtnGeyTbvnrRkvNfp5F0xbZb7RiJkKz1D/mtT6QpUEFWHpKrbYwPW4EM+psJ31RleUHwi64Q2rzucelIBaNTYv2PPtA2yHIv4+J7uwGX0ZCLgcBCalDXwmVnjxZcFGgqkadTYVTfygNOvG9SN89BijVmnX0hifyfDBJBCb1wmjuC+/b48wL2hLXsC5W+Wcafv7llzlmhHjoy61Lt4//Z6yJTMelGZ9l4sroCgBV9b6CkOjOaeIOeEyfDawv1 matt@macbook-pro.lan
@msmithstubbs
msmithstubbs / button.html
Created April 16, 2014 13:47
Add Back In Stock button to the product page for the Shopify Timber theme
<input type="submit" name="add" class="btn" id="addToCart" value="Add to Cart">
<input type="button" name="bis" class="btn-secondary" id="BIS_trigger" value="Email when available">