Skip to content

Instantly share code, notes, and snippets.

<!-- Step 1: Add your filters -->
<!-- The collection filter is entirely optional -->
<!-- You can have as many as 3 of the product tags filters -->
<ul class="clearfix">
<li class="clearfix filter">
<p>Shop by category</p>
<select class="coll-picker">
<option value="all">All</option>
{% for c in collections %}
@freakdesign
freakdesign / select-from-hash
Last active October 29, 2018 08:00
Javascript snippet to help auto select a Shopify variant from a hash.
<script type="text/javascript">
/*
re: http://ecommerce.shopify.com/c/ecommerce-design/t/land-on-specific-variant-when-loading-product-page-147793
Assumes:
--------
* that you are calling the javascript once the select element is available
* you have a select element on the page like:
@freakdesign
freakdesign / extract-image-liquid
Last active May 8, 2023 14:15
Get image src from a string in Liquid
{% if article.content contains "<img" %}
{% assign src = article.content | split: 'src="' %}
{% assign src = src[1] | split: '"' | first | replace: '//cdn', 'http://cdn' | replace: 'http:http://', 'http://' | remove: 'https:' %}
{% endif %}
/*
* Shopify checkout reset
*/
/* Reset base elements */
body, h1, h2, h3, h4, h5, h6, p, h1 span.subtitle, h3.divider, #welcome, #container, #container.slim, #main, #container.slim #main, #content, #header, #container.slim #header, #header h1,
#info-bar, #footer, .footer p, #container.slim #footer, #overview, #overview h2, #overview a, #products, #done, #wallet, div.wallet-highlight, #cost, #order-num, #success, #steps, #thumbs,
#thumbs div, #thumbs td, .slim #thumbs td, #thumbs h3, #thumbs h3 span, #thumbs span, #overview .hint, #payment-type, #payment-type li, #payment-type li:hover, li.text-payment, .center,
#addresses, #email, #email label, #email input, #shipping-same label, .address-notification, #gateway-logos, #gateway-logos img, #pay-with, #pay-with h3, #payment, #or, #payment-methods li,
#payment-methods input, #credit-card-valid, img.credit-card, .field-with-errors, .field-with-errors input, .field-with-errors .error-message, .severe-error, .gleft, .gright, label,
@freakdesign
freakdesign / simple-loader.css
Created December 5, 2013 06:30
Lightweight CSS3 loading animation
.loading {
border: .25em solid rgba(0, 0, 0, .1);
border-top: .25em solid rgba(255, 0, 0, .5);
border-radius: 100%;
height: 1em;
width: 1em;
animation: rot .5s infinite linear;
}
@keyframes rot {
@freakdesign
freakdesign / three-level-menu.liquid
Created December 16, 2013 12:44
Three level deep menu for Shopify using linklists
<ul>
<li><a href="/collections/all">Products</a>
{% if linklists.main-menu.size > 0 %}
<ul>
{% for link in linklists.main-menu.links %}
<li>{{ link.title | link_to: link.url }}</li>
{% endfor %}
</ul>
{% endif %}
</li>
// (c) Copyright 2014 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com
// See http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/linked-product-options
// jQuery 1.7+
var Shopify = Shopify || {};
Shopify.optionsMap = {};
Shopify.updateOptionsInSelector = function(selectorIndex) {
var singleOptionSelectors = jQuery('select.single-option-selector');
@freakdesign
freakdesign / edit-button-min.js
Last active August 26, 2016 14:42 — forked from carolineschnapp/new_gist_file.liquid
Add edit button to Shopify page
(function(){if(document.getElementById("admin_bar_iframe")){var d=function(a){"undefined"===typeof a&&(a="Sorry, that can not be run here...");console.warn(a);return!1},e=function(a,c){var b=new XMLHttpRequest;b.open("GET",a,!1);b.onreadystatechange=function(){if(4==b.readyState&&200==b.status&&"function"===typeof c){var a;a:{try{JSON.parse(b.responseText)}catch(e){a=!1;break a}a=!0}if(!a)return d("That does not look like json...");a=JSON.parse(b.responseText);c(a,Object.keys(a)[0])}};b.send()},c=
document.createElement("button");c.id="admin_bar_iframe";c.style="position: fixed;top: 70px;right: 1em;background-color: rgb(16, 206, 223);padding: .75em 1em;color: #FFF;cursor: pointer;border:none;z-index:99999";c.innerHTML="Edit This";c.addEventListener("click",function(a){a.target.blur();if("/"===location.pathname)return d();if("blogs"===location.pathname.split("/")[1])return"undefined"!==typeof __st&&__st.s?(location.href=[location.protocol,"//",location.host,"/admin/articles/",__st.s.split("-")[1]].join(""),
!1
@freakdesign
freakdesign / blog-atom.liquid
Last active October 19, 2021 21:48
Shopify RSS atom feed
{% layout none %}{% comment %}
/*
* Simple blog feed
*
* Copyright (c) 2015 Jason Bowman (jason@freakdesign.com.au)
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
*/
{% endcomment %}<?xml version="1.0" encoding="UTF-8"?>
@freakdesign
freakdesign / shopify-sitelink-search.liquid
Last active February 8, 2018 17:45
Google Sitelinks Search Box for Shopify