Skip to content

Instantly share code, notes, and snippets.

View cargix1's full-sized avatar

Andrew Cargill cargix1

View GitHub Profile
var jQuery = require('jquery');
(function ($) {
/**
* @function
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM
* @param {function} handler A function to execute at the time when the element is inserted
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation
* @example $(selector).waitUntilExists(function);
@cargix1
cargix1 / gist:e7f04214915383c9e198
Last active September 11, 2015 22:59
Filter for select fields using Vue.js. You can call
# Add the following to your app.js file.
Vue.filter('extract', function (values, option_value, option_label) {
var response = [];
values.forEach(function (value) {
response.push({
text: value[option_label],
{% if template contains 'cart' %}
<script type="text/javascript">
$(document).ready(function() {
$("[name='checkout']").on("click", function() {
var date = $(".zapietCollectionDate").val();
var locationId = $(".clickCollectLocation").val();
if(locationId != 'none') {
if(date == '') {
@cargix1
cargix1 / gist:0039565fd832ac5c4dcd
Created September 23, 2015 16:35
Datepicker validation when using ajax cart
1). Add the following code towards the bottom of your theme.liquid file. Ensure it's above the code shown in step 2.
<script>
function checkDateTime() {
$("[name='checkout']").on("click", function() {
var date = $(".zapietCollectionDate").val();
var locationId = $(".clickCollectLocation").val();
{% if template contains 'cart' %}
<script type="text/javascript">
$(document).ready(function() {
$("[name='checkout']").on("click", function() {
var date = $(".zapietCollectionDate").val();
if(date == '') {
alert('Please select a date and time.');
return false;
}
@cargix1
cargix1 / gist:2b4957ac5d049482cb69
Created October 10, 2015 11:00
Default Order Confirmation Template
<p>Thank you for placing your order with {{ shop_name }}!</p>
<p>This email is to confirm your recent order.</p>
<p>Date {{ date | date: "%m/%d/%Y" }}</p>
{% if requires_shipping and shipping_address %}
<p><b>{% if attributes.Store-Pickup-Order == "Yes" %}Pickup location{% else %}Shipping address{% endif %}</b><br />
{% if attributes.Store-Pickup-Order == "Yes" %}{{ shipping_address.company }}{% else %}{{ shipping_address.name }}{% endif %}<br />
{{ shipping_address.street }}<br />
{{ shipping_address.city }}<br />
{{ shipping_address.province }}
{{ shipping_address.zip }}<br />
@cargix1
cargix1 / gist:8b355458278b0a948646
Created October 13, 2015 20:58
Default New Order Notification
<p>Hello {{ shop_name }},</p>
<p></p>
<p>{% if customer.name %}{{ customer.name }}{% else %}Someone{% endif %} placed a new order with your store, {{ date | date: "%b %d %I:%M%p" }}:</p>
<p></p>
<ul> {% for line in line_items %} <li> <img src="{{ line | img_url: 'thumb' }}" /> {{ line.quantity }}x {{ line.title }} for {{ line.price | money }} each </li> {% endfor %} </ul>
<a href="https://{{ shop.permanent_domain }}/admin/orders/{{ id }}">View order {{order_name}} </a>
{% if fulfillment_aborted %}
<p>The above order was not automatically fulfilled because it was flagged as suspicious.</p>{% endif %}
<p></p><br>
{% if has_high_risks? %}<p><b>Security check:</b></p>
@cargix1
cargix1 / shopify-countries-counties-list.json
Created October 14, 2015 09:45
Shopify Countries/Counties list
{
"Canada": {
"label": "Province",
"zip_label": "Postal code",
"zip_placeholder": "Postal code",
"zip_required": true,
"province_label": "Province",
"provinces": [
"Alberta",
"British Columbia",
@cargix1
cargix1 / order-confirmation-v2.0.liquid
Last active February 28, 2016 13:12
Order Confirmation v2.0
<p>Thank you for placing your order with {{ shop_name }}!</p>
<p>This email is to confirm your recent order.</p>
<p>Date {{ date | date: "%m/%d/%Y" }}</p>
{% if requires_shipping and shipping_address %}
<p><b>{% if attributes.Checkout-Method == "pickup" %}Pickup location{% elsif attributes.Checkout-Method == "delivery" %}Delivery address{% else %}Shipping address{% endif %}</b><br />
{% if attributes.Checkout-Method == "pickup" %}
{{ shipping_address.company }}<br />
{% else %}
{{ shipping_address.name }}<br />
{% endif %}
@cargix1
cargix1 / new-order-confirmation-v2.0.liquid
Last active June 15, 2016 10:02
New order confirmation v2.0
<p>Hello {{ shop_name }},</p>
<p></p>
<p>{% if customer.name %}{{ customer.name }}{% else %}Someone{% endif %} placed a new order with you today, {{ date | date: "%b %d %I:%M%p" }}:</p>
<p></p>
<ul style="list-style-type:none">{% for line in line_items %}<li> <img src="{{ line | img_url: 'thumb' }}" /> {{ line.quantity }}x {{line.title }} (sku: {{ line.sku }})<br>{% for p in line.properties %}{% if p.first == "builder_id" or p.first == "builder_info" or p.first == "master_builder" or p.last == "" %}{% else %}{{ p.first }}: {% if p.last contains '/uploads/' %}<a class="lightbox" href="{{ p.last }}">{{ p.last | split: '/' | last }}</a><br>{% else %}{{ p.last }}<br>{% endif %}{% endif %}{% endfor %}</li>{% endfor %}</ul>
<a href="{{ shop.url }}/admin/orders/{{ id }}">View order {{order_name}} </a>
{% if fulfillment_aborted %}
<p>The above order was not automatically fulfilled because it was flagged as suspicious.</p>{% endif %}
<p></p><br>