Skip to content

Instantly share code, notes, and snippets.

View drabbytux's full-sized avatar

David Little drabbytux

View GitHub Profile
@drabbytux
drabbytux / 0_reuse_code.js
Created April 25, 2016 15:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@drabbytux
drabbytux / size-chart.liquid
Created December 10, 2016 10:00 — forked from carolineschnapp/size-chart.liquid
size-chart.liquid snippet
{% if template contains 'product' %}
{% assign size_options = 'size,taille' | split: ',' %}
{% assign size_chart_text_link = 'Size chart' %}
{% assign has_size = false %}
{% assign size_index = 0 %}
{% for option in product.options %}
{% assign downcased_option = option | downcase %}
{% if has_size == false and size_options contains downcased_option %}
{% assign has_size = true %}
{% assign size_index = forloop.index0 %}
@drabbytux
drabbytux / allow-pre-orders.md
Last active December 10, 2016 17:41
Allow pre-orders for products

layout: default title: Allow pre-orders for products sidebar_title: Allow pre-orders description: If you have a product on back order, you can display it as pre-order only on your online Shopify store.

difficulty: intermediate

incompatible-themes: [ "Minimal", "Solo" ] supported: false

nav:

@drabbytux
drabbytux / select-variants-by-clicking-images.md
Last active December 10, 2016 20:29
Select product variants by clicking their images
layout title sidebar_title description nav
default
Select product variants by clicking their images
Select variants by clicking their images
Enable customers to select a product variant by clicking its image on your online Shopify store.
group
products
@drabbytux
drabbytux / pick-an-option.liquid
Created December 10, 2016 21:07 — forked from carolineschnapp/pick-an-option.liquid
Make 'Pick an option' the default choice in product drop-down menus
{% comment %}
See https://docs.shopify.com/themes/customization/products/how-to-add-a-pick-an-option-to-drop-downs
{% endcomment %}
{% unless product.selected_variant %}
{% if product.variants.size > 1 %}
<script>
var $addToCartForm = $('form[action="/cart/add"]');
if (window.MutationObserver && $addToCartForm.length) {
if (typeof observer === 'object' && typeof observer.disconnect === 'function') {
@drabbytux
drabbytux / pick-an-option-product-template.js
Created December 11, 2016 00:37
Make 'Pick and Option" by Default for product-template.liquid
<script>
var productOptions = [];
{% for option in product.options %}
var optionObj = {};
optionObj[ {{ forloop.index0 }} ] = "{{ product.options[forloop.index0] }}";
productOptions.push(optionObj);
{% endfor %}
</script>
@drabbytux
drabbytux / limiting-purchase-quantities.md
Last active December 13, 2016 14:41
Limiting purchase quantities
layout title sidebar_title description nav
default
Limiting purchase quantities
Limiting purchase quantities
Learn about a workaround and an app for limiting purchases.
group weight
Inventory
9
{{ '//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css' | stylesheet_tag }}
{{ '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js' | script_tag }}
<div style="width:300px; clear:both;">
<p>
<label for="date">Pick a delivery date:</label>
<input id="date" type="text" name="attributes[date]" value="{{ cart.attributes.date }}" />
<span style="display:block" class="instructions"> We do not deliver during the week-end.</span>
</p>
</div>
@drabbytux
drabbytux / add-date-picker-for-delivery-dates.md
Last active December 15, 2016 00:50
Add a date picker to get delivery dates on your cart page

###Modifications

  1. Add this to the bottom of the Assets/theme.js file:
$(document).ready( function() {
  $(function() {
    $("#date").datepicker( { 
      minDate: +1, 
      maxDate: '+2M',
 beforeShowDay: jQuery.datepicker.noWeekends
@drabbytux
drabbytux / add-terms-and-conditions-checkbox.md
Last active December 16, 2016 02:51
Add an agree to terms and conditions checkbox
layout title sidebar_title description nav
default
Add an agree to terms and conditions checkbox
Add a terms and conditions checkbox
Add an Agree to terms and conditions checkbox to the cart page of your online Shopify store.
group
cart