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 / split shopify description.liquid
Created June 8, 2018 10:10
splitting shopify description
{% assign description_parts = product.description | split: '<!-- split -->' %}
Amount of parts: {{ description_parts.size }}
Index of last part: {% assign index_last = description_parts.size | minus: 1 %}
First part: {{ description_parts.first }}
First part: {{ description_parts[0] }}
Second part: {{ description_parts[1] }}
Third part: {{ description_parts[2] }}
Fourth part: {{ description_parts[3] }}
Last part: {{ description_parts.last }}
Last part: {{ description_parts[index_last] }}
@joe-dempsey
joe-dempsey / Shopify add color swatches to collection pages.txt
Created June 4, 2018 12:29
Shopify add color swatches/dots to collection pages.
{% capture option_titles %}Color,color,Colour,colour{% endcapture %}
{% assign option_titles = option_titles | split:',' %}
{% for option in product.options %}
{% if option_titles contains option %}
{% capture option_index %}option{{ forloop.index }}{% endcapture %}
{% assign option_values = product.variants | map: option_index | uniq %}
{% if option_values.size != 1 %}
{% for opt in option_values %}
@joe-dempsey
joe-dempsey / related-products.liquid
Last active October 18, 2021 15:53
related-products.liquid for narrative theme
@joe-dempsey
joe-dempsey / Shopify Email Hosting DNS Configuration
Created May 12, 2018 11:56
Shopify Email Hosting DNS Configuration - how to configure Shopify email hosting DNS for Shopify and business email
// The below DNS records will allow a user to have a Shopify store as well as pricate email hosting via Shopped.email
// These are the main records required - you may also need other.
// points your store and www version to Shopify.
www CNAME: shops.myshopify.com
@ A record: 23.227.38.32
MX record: mx.yourstorename.com.cust.hostedemail.com
@joe-dempsey
joe-dempsey / shopify reviews widget
Last active October 14, 2018 16:12
Shopify reviews widget slick
{% if section.settings.show_reviews_slider %}
<div class="review_wrapper">
<h2 class="center home-section--title">{{ section.settings.reviews_title }}</h2>
<div data-section-id="{{ section.id }}" id="slick-{{ section.id }}" class="slickslider reviews-responsive{% if section.settings.slideshow_width == 'contained' %} collection-list--container {% endif %}" data-section-type="reviews-slideshow-section">
{% for block in section.blocks %}
<div class="brand-slide">
<img src="{{ 'reviews_stars.png' | asset_img_url: 'original' }}" alt="5 star review">
<h4>{{ block.settings.review_title }}</h4>
<div class="reviews_copy">{{ block.settings.review_copy }}</div>
@joe-dempsey
joe-dempsey / Shopify pricing - show shopify discount price and percentage in Liquid.liquid
Created April 5, 2018 18:04
Shopify pricing - show shopify discount price and percentage in Liquid
The following code will show a percentage discount on sale products.
{% if product.compare_at_price_max > product.price %}You save {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%{% endif %}
@joe-dempsey
joe-dempsey / collection filter.liquid
Last active July 8, 2023 03:10
collection filter updated
<div class="desktop-2 tablet-6 mobile-3" id="aside">
<div id="sidebar">
<div class="desc-accordion">
@joe-dempsey
joe-dempsey / gist:6524175e114591531ff26bc1201744ac
Last active October 14, 2018 16:12
filters again revisited with more examples. Shopify
<div class="desktop-2 tablet-6 mobile-3" id="aside">
<div id="sidebar">
{% comment %}
{% if collection.image %}
{{ collection.image.src | collection_img_url: 'compact' | img_tag: collection_title }}
{% endif %}
{% endcomment %}
@joe-dempsey
joe-dempsey / gist:e6f6bf021ac6e40eafa7e9ac07359f15
Created March 6, 2018 16:22
tags filter shopify new - group tags
{% comment %} filters by style {% endcomment %}
{% assign tags = section.settings.tags_4 | split: ',' %}
{% assign show-filter = false %}
{% for tag in tags %}
{% if collection.all_tags contains tag %}
{% assign show-filter = true %}
{% endif %}
{% endfor %}
<script type="text/javascript">
jQuery.ajax( {
url: '//freegeoip.net/json/',
type: 'POST',
dataType: 'jsonp',
success: function(location) {
// If the visitor is browsing from US.
if (location.country_code === 'US') {
// DO NOTHING for now