Skip to content

Instantly share code, notes, and snippets.

View JamieS's full-sized avatar

Jamie Sutton JamieS

View GitHub Profile
@carolineschnapp
carolineschnapp / gist:80eee3bab50f920f84b4
Last active June 21, 2021 20:39
JavaScript redirect to force HTTPs
if (location.protocol !== "https:") {
location.protocol = 'https:';
}
@carolineschnapp
carolineschnapp / variant-images-in-cart.html
Last active February 11, 2022 07:16
Script that updates images on the cart page to show the correct thumbnail as chosen in the Variant Images app.
{% if cart.item_count > 0 %}
<script>
// Script that updates images on the cart page to show the correct thumbnail as chosen in the Variant Images app.
// This works with any markup.
// This works when using Line Item Properties where several items in the cart form can share the same variant ID.
// Author: Caroline Schnapp.
// Place at the top of your cart.liquid template.
(function($) {
var variantImages = {},
productHandles = [];
@JamieS
JamieS / gist:1083549
Created July 14, 2011 21:49 — forked from carolineschnapp/gist:1083007
Linked options helper methods for Shopify. See this: http://wiki.shopify.com/Linked_Options
<script>
// (c) Copyright 2011 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com
// See http://wiki.shopify.com/Linked_Options
Shopify.optionsMap = {};
Shopify.updateOptionsInSelector = function(selectorIndex) {
var key = jQuery('.single-option-selector:eq(0)').val();
if (selectorIndex === 2) {
key += ' / ' + jQuery('.single-option-selector:eq(1)').val();
}
var selector = jQuery('.single-option-selector:eq(' + selectorIndex + ')');
@resistorsoftware
resistorsoftware / Liquid snippet for theme.liquid
Created February 25, 2011 13:55
How to add Meta Descriptions to a Product
{% if template == 'product' %}
{% assign mf = product.metafields.meta_description %}
{% unless mf == empty %}
{% for mf in product.metafields.meta_description %}
<meta name="Fubar2 Ronnie James Dio" content="{{mf.last}}" />
{% endfor %}
{% endunless %}
{% endif %}
/*
* mediaquery function - test whether a CSS media type or query applies
* author: Scott Jehl
* Copyright (c) 2010 Filament Group, Inc
* MIT license
* Developed as a feature of the EnhanceJS Framework (enhancejs.googlecode.com)
* thx to:
- phpied.com/dynamic-script-and-style-elements-in-ie for inner css text trick
- @paul_irish for fakeBody trick
*/