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 / gist:e94442a4be9fc92bdb1a631540a0b2c5
Created August 13, 2018 11:21
related products shopify.
{% if section.settings.show_related_products == true %}
<hr>
<div class="product-template__container page-width" itemscope itemtype="http://schema.org/Product" id="ProductSection-{{ section.id }}" data-section-id="{{ section.id }}" data-section-type="product" data-enable-history-state="true">
{% comment %}
Number of related items per row,
and number of rows.
{% endcomment %}
{% assign number_of_related_products_per_row = section.settings.related_grid_num %}
@joe-dempsey
joe-dempsey / Bitcoin Mining Hardware Shopify.txt
Created July 23, 2018 14:26
Bitcoin Mining Hardware Shopify
#!/bin/bash
set -e
set -o pipefail
log_title() {
local code="\033["
local color="${code}1;34m"
[ -z "$text" ] && local text="$color$1${code}0m"
echo -e "\n$text"
}
@joe-dempsey
joe-dempsey / gist:3b8ecb06940c5d5ffb481432002ff01d
Created July 11, 2018 15:20
section half alternating blocks
<div data-section-id="{{ section.id }}" id="mysection_{{ section.id }}" class="richtext-custom-section contain-full-width no-padding ">
{% for block in section.blocks %}
{% capture thecycle %}{% cycle 'odd', 'even' %}{% endcapture %}
{% if thecycle == 'odd' %}
<div class="odd_block">
<div class="one-half-custom odd_img ">
{% if block.settings.custom_image %}
<img src="{{ block.settings.custom_image | img_url: '2048x' }}" />
{%endif%}
@joe-dempsey
joe-dempsey / shopify colors for a product.liquid
Last active January 31, 2023 16:12
Shopify colors for a product.
{% capture option_titles %}Color,color,Colour,colour{% endcapture %}
<div class="color_swatches_collection">
{% 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 != 0 %}
{% for opt in option_values %}
<div style="background-color:{{ opt | downcase }};" class="option_circles"></div>
@joe-dempsey
joe-dempsey / shopify preview theme
Created July 5, 2018 09:55
Shopify preview theme old skool (kinda needed sometimes)
https://store.com/?preview_theme_id=
https://store.com/?preview_theme_id=
@joe-dempsey
joe-dempsey / gist:e63ed2f68f3e97c79bd9e9f28d66c213
Created July 4, 2018 14:32
Shopify color swatches done by product type and metafields
{%- comment -%}
colors done by product type and metafields
{%- endcomment -%}
{%- capture the_type -%}{{ product.type }}{%- endcapture -%}
<div class="swatch_wrap">
{% for p in collections.all.products %}
{% if p.type == the_type %}
{% comment %} will output sizes if they are first option{% comment %}
<ul class="product-sizes">
{% for variant in product.variants %}
{% if variant.available %}
<li>{{ variant.option1 }}</li>
{% else %}
<li class="disable">{{ variant.option1 }}</li>
{% endif %}
{% endfor %}
@joe-dempsey
joe-dempsey / shopify image blog first available
Created June 27, 2018 12:32
shopify blog show first available image if no featured image
{% if article.image.size > 0 %}
# show featured image
{% else %}
{% if article.content contains "<img" %}
{% assign src = article.content | split: 'src="' %}
{% assign src = src[1] | split: '"' | first %}
<img src="{{ src }}" alt="{{ article.title }}">
{% endif %}
{% endif %}
@joe-dempsey
joe-dempsey / how to show related products shopify
Created June 19, 2018 09:43
show related products shopify
@joe-dempsey
joe-dempsey / Shopify pricing calculator code
Last active October 14, 2018 16:12
Shopify Pricing Calculator Code - used to calculate shopify pricing plans, fees and costs.
// make pretty selects
$(document).ready(function() {
$('select').niceSelect();
});
// before any changes
$( document ).ready(function() {