Skip to content

Instantly share code, notes, and snippets.

View rickydazla's full-sized avatar

Rick Davies rickydazla

View GitHub Profile
@rickydazla
rickydazla / cart-item_count.liquid
Created December 4, 2013 22:08
Shopify cart.item_count when Gift Wrapping Product exists
{% assign gift_wrapped = 0 %}
{% for item in cart.items %}
{% if item.product.handle == 'gift-wrap' %}
{% assign gift_wrapped = item.quantity %}
{% endif %}
{% endfor %}
{{ cart.item_count | minus: gift_wrapped }}
@rickydazla
rickydazla / wishlist-link.html
Last active December 27, 2015 12:39
Addthis / Jeffie.com Shopify Wishlist Sharing
@rickydazla
rickydazla / retina-logo.html
Last active March 10, 2016 02:04
Shopify Retina SVG logo switcheroo_modernizr
<a href="{{ shop.url }}">
<img
src="{{ 'logo.png' | asset_url }}"
alt="{{ shop.name }}"
data-retina-src="{{ 'logo.svg' | asset_url }}">
</a>
<script type="text/javascript">
Modernizr.addTest('retina', function () {
return (!!navigator.userAgent.match(/Macintosh|Mac|iPhone|iPad/i) && window.devicePixelRatio==2);
});
@rickydazla
rickydazla / product.liquid
Last active December 27, 2015 02:19
CloudZoom for Shopify
<ul>
<li class="featured">
<a href="{{ product.images[0] | product_img_url: 'original' }}" class="cloud-zoom" id="zoom1" rel="position: 'inside'">
<img src="{{ product.images[0] | product_img_url: 'large' }}" alt="{{ product.title | escape }}: Featured Product Image">
</a>
</li>
{% for img in product.images %}
<li>
<a href="{{ img | product_img_url: 'original' }}" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage: '{{ img | product_img_url: "large" }}' ">
<img src="{{ img | product_img_url: 'medium' }}" alt="{{ product.title | escape }}: Alternate View #{{ forloop.index }}">
@rickydazla
rickydazla / ajaxsubscribe.liquid
Last active December 25, 2015 13:48 — forked from jdennes/LICENSE
Campaign Monitor AJAX Popup Signup; edited for Tricky3 / Shopify, Liquid
<!-- 1. Take your Campaign Monitor subscribe form as generated from within your account [now iz html5]: -->
<form action="http://myaccount.createsend.com/a/b/c/defgh/" method="post" id="subForm">
<div>
<label for="name">Name:</label><br>
<input type="text" name="cm-name" id="name"><br>
<label for="abcd-efgh">Email:</label><br>
<input type="text" name="cm-abcd-efgh" id="abcd-efgh" placeholder="Your Email Address"{% if customer %} value="{{ customer.email }}"{% endif %} required><br>
<input type="submit" value="Subscribe">
</div>
@rickydazla
rickydazla / cart_free-gift.js
Last active June 6, 2017 05:49
Shopify free gift cart mangling
/* Uses Cart.js http://cartjs.org/ */
{% if linklists.free-gifts.links and linklists.free-gifts.links.size > 0 %}
<script type="text/javascript">
CartJS.init({{ cart | json }});
var freeGiftURLs = [];
var freeGiftNames = [];
var freeGiftIDs = [];
{% for link in linklists.free-gifts.links %}
freeGiftURLs.push('{{ link.url | escape }}');
freeGiftNames.push('{{ link.title | escape }}');
// Form tag will look something like this by default:
// <form action="http://xxxxx.us#.list-manage1.com/subscribe/post?u=xxxxx&id=xxxx" method="post" ... >
// change it to look something like this
// <form action="http://xxxxx.us#.list-manage1.com/subscribe/post-json?u=xxxxx&id=xxxx&c=?" method="get" ... >
$(document).ready( function () {
var $form = $('form');
if ( $form.length > 0 ) {
@rickydazla
rickydazla / greyscale.css
Last active December 11, 2015 12:29
CSS3 greyscale/monochromed image rollover effect.
.color-to-monochrome-rollover img{
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale");
-webkit-filter: grayscale(0%);
}
.color-to-monochrome-rollover a:hover img{
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(100%);
-webkit-transition: all 0.5s ease-out; /* Safari 3.2+, Chrome */
-moz-transition: all 0.5s ease-out; /* Firefox 4-15 */
@rickydazla
rickydazla / addthis_shopify.html
Last active December 11, 2021 23:40
Custom addthis widget for Shopify using SymbolSet Social Icon fonts
<div class="addthis_toolbox" addthis:url="{{ shop.url }}{{ product.url }}" addthis:title="{{ page_title }} | {{ shop.name }}" addthis:description="{{ page_description }}">
<div class="tricky-sharing">
<a class="addthis_button_facebook"><i class="ss-facebook"></i></a>
<a class="addthis_button_twitter"><i class="ss-twitter"></i></a>
<a class="addthis_button_pinterest ss-icon ss-pinterest" pi:pinit:media="{{ product.images[0] | product_img_url: '1024x1024' }}"></a>
<!-- you can also try addthis_button_pinterest_share if above doesn't work! -->
</div>
</div>
@rickydazla
rickydazla / currencies-switcher.liquid
Created May 24, 2012 18:06 — forked from carolineschnapp/currencies.liquid
Snippet for currencies (w/ <a> rather than <select>)
{% unless settings.multiple-currency == 'disabled' %}
<div id="currencies">
{% for i in (1..64) %}
{% capture code %}{% cycle 'code' : 'USD','EUR','GBP','CAD','ARS','AUD','BSD','BHD','BRL','BGN','CLP','CNY','COP','CRC','HRK','CZK','DKK','XCD','EEK','FJD','GTQ','HKD','HUF','ISK','INR','IDR','ILS','JMD','JPY','JOD','KZT','KES','KWD','LVL','LTL','MXN','MYR','NZD','NGN','NOK','OMR','PEN','PHP','PLN','QAR','RON','RUB','SAR','SGD','SYP','ZAR','KRW','LKR','SEK','CHF','TWD','THB','TZS','TTD','TRY','UAH','AED','UYU','VEB' %}{% endcapture %}
{% capture setting %}currency-{{ code }}{% endcapture %}
{% capture label %}{% cycle 'label' : '$','&euro;','&pound;','Canadian Dollars (CAD)','Argentine Pesos (ARS)','Australian Dollars (AUD)','Bahamian Dollar (BSD)','Bahraini Dinar (BHD)','Brazilian Real (BRL)','Bulgarian Lev (BGN)','Chilean Peso (CLP)','Chinese Yuan Renminbi (CNY)','Colombian Peso (COP)','Costa Rican Colones (CRC)','Croatian Kuna (HRK)','Czech Koruny (CZK)','Danish Kroner (DKK)','East Caribbean Dollar (XCD