Skip to content

Instantly share code, notes, and snippets.

View joe-dempsey's full-sized avatar

joe dempsey joe-dempsey

View GitHub Profile
@joe-dempsey
joe-dempsey / image cycle shopify
Created April 21, 2017 14:10
cycle images Shopify
{% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %}
{{ 'collection-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
@joe-dempsey
joe-dempsey / device target
Created April 21, 2017 16:00
target devices with js
// useful example
if ($(window).width() < 1024) {
$( ".header__item-language" ).insertBefore( "#lang_inject_mobile" );
}
$( window ).resize(function() {
// position the lang picker when resizing
if ($(window).width() < 1024) {
@joe-dempsey
joe-dempsey / tag filter shopify
Created April 22, 2017 09:40
Tag filter via theme options Shopify
{% comment %}Tag filters{% endcomment %}
{% comment %}https://help.shopify.com/themes/customization/collections/filtering-a-collection-with-multiple-tag-drop-down{% endcomment %}
{% comment %}Modified so they can be captured in theme options.{% endcomment %}
{% comment %}first grab and assign some stuff{% endcomment %}
{% capture tags_list %}{{ section.settings.tags_list | prepend: "'," | append: "'" }}{% endcapture %}
{% if collection.url.size == 0 %}
{% assign collection_url = '/collections/all' %}
{% else %}
@joe-dempsey
joe-dempsey / Shopify autofil checkout fields
Created May 8, 2017 11:28
Shopify autofil checkout fields
Turns out you can construct the URL like this to autofill the fields:
checkoutUrl = variant.checkoutUrl()
checkoutUrl += "&checkout[email]=#{email}" +
"&checkout[billing_address][first_name]=#{firstName}" +
"&checkout[billing_address][last_name]=#{lastName}" +
"&checkout[billing_address][address1]=#{address}" +
"&checkout[billing_address][city]=#{city}" +
"&checkout[billing_address][country]=#{country}" +
"&checkout[billing_address][zip]=#{postalCode}"
@joe-dempsey
joe-dempsey / article next previous.liquid
Created May 11, 2017 09:32
Shopify Blog preview next article
{% if blog.next_article %}
<b>{{ 'blogs.article.newer_post' | t | link_to: blog.next_article }}</b><span> | </span>
{% endif %}
<b>{{ 'All Articles' | link_to: blog.url }}</b>
@joe-dempsey
joe-dempsey / landing-code.liquid
Created May 18, 2017 13:10
landing page for mikkel
{% section 'slideshow-landing' %}
{% section 'slideshow-landing-mobile' %}
{% section 'featured-content-landing' %}
{% section 'mobile_extras' %}
{% section 'tiled-images-landing' %}
{% section 'featured-collection-landing' %}
{% section 'tiled-images-landing-2' %}
{% section 'featured-collection-landing-2' %}
{% section 'tiled-images-landing-3' %}
@joe-dempsey
joe-dempsey / dynamic-remarketing.liquid
Last active May 23, 2017 11:36
Dynamic remarketing in liquid
<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
--------------------------------------------------->
{% assign prodid = '' %}
{% assign value = '' %}
{% if template contains 'index' %}
{% assign pagetype = 'home' %}
{% layout none %}<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="rss.css" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<atom:link href="{{shop.url}}/pages/feed" rel="self" type="application/rss+xml" />
<products>{% paginate collections.all.products by 1000 %}{% for product in collections.all.products %}
<product>
<ProductCategory>{{ product.type }}</ProductCategory>
<ProductName>{{ product.title | strip_html | strip_newlines | escape | replace: '&', 'and' }}</ProductName>
<ProductSKU>{{ product.sku }}</ProductSKU>
<ProductPrice>{{ product.price | money }}</ProductPrice>
@joe-dempsey
joe-dempsey / shopify-loop.liquid
Created May 30, 2017 10:18
example of shopify i loop to build old skool sectionless stuff - keeping for basic maintenance needs/examples.
<section class="homepage-section animate wow fadeIn">
{% if settings.display-wide %}
{% else %}
<div class="row">
<div class="desktop-12 tablet-6 mobile-3">
{% endif %}
{% if settings.homepage-display == 'video' %}
<div class="videoWrapper">
{{ settings.video-embed }}
@joe-dempsey
joe-dempsey / template name.liquid
Created June 15, 2017 12:48
get a template name and use for summat shopify template name in liquid
{{ template | replace: '.', '_' | handelize }}