Skip to content

Instantly share code, notes, and snippets.

View whistlerbrad's full-sized avatar

Brad whistlerbrad

View GitHub Profile
{%- assign grid_item_width = 'large--one-half' -%}
{% case section.settings.grid %}
{% when 1 %}
{%- assign grid_item_width = 'large--one-half collection-grid--single' -%}
{% when 2 %}
{%- assign grid_item_width = 'large--one-half' -%}
{% when 3 %}
{%- assign grid_item_width = 'large--one-third' -%}
{% when 4 %}
@whistlerbrad
whistlerbrad / settings_data.json
Last active November 17, 2018 07:36
Story - Lookbook samples
{
"current": {
"type_heading_font": "itc_caslon_no_224_n9",
"type_heading_size": 100,
"type_base_font": "harmonia_sans_n4",
"type_body_size": 100,
"type_number_font": "din_next_slab_n4",
"type_number_size": 100,
"color_body_text": "#586272",
"accent_warm": "#ff8277",
@whistlerbrad
whistlerbrad / include-remove-variant
Created November 16, 2018 22:52
Include before </body>
{% include 'remove-variant' %}
@whistlerbrad
whistlerbrad / remove-variant.liquid
Created November 16, 2018 22:43
Remove specific variants
{% comment %}
Remove specific variants.
{% endcomment %}
{% if product.options.size == 1 %}
<script>
var $addToCartForm = $('form[action="/cart/add"]');
if (window.MutationObserver && $addToCartForm.length) {
if (typeof observer === 'object' && typeof observer.disconnect === 'function') {
observer.disconnect();
@whistlerbrad
whistlerbrad / index-video-button.liquid
Created November 15, 2018 02:26
Pipeline 4.3 video with button option
<!-- /sections/index-video-button.liquid -->
{%- if section.settings.image -%}
{%- assign img_object = section.settings.image -%}
{%- assign img_small = section.settings.image | img_url: '18x' -%}
{%- assign img_api = section.settings.image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{%- else -%}
{%- assign img_object = 'blank.svg' | asset_url -%}
{%- assign img_small = 'blank.svg' | asset_url -%}
{%- assign img_api = 'blank.svg' | asset_url -%}
{%- endif -%}
@whistlerbrad
whistlerbrad / nav-contents.liquid
Created November 14, 2018 20:30
Pipeline 4.2 version with number of items in cart instead of cost value
<div class="mobile-wrapper">
<div class="header-cart__wrapper">
<a href="/cart" class="CartToggle header-cart"></a>
<span class="header-cart__bubble cartCount{% if cart.item_count < 1 %} hidden-count{% endif %}"></span>
</div>
<div class="logo-wrapper{% if section.settings.logo %} logo-wrapper--image{% endif %}">
{% if template == 'index' %}
<h1 class="h4 header-logo" itemscope itemtype="http://schema.org/Organization">
{% else %}
<div class="h4 header-logo" itemscope itemtype="http://schema.org/Organization">
@whistlerbrad
whistlerbrad / product.liquid
Created November 7, 2018 03:16
product.liquid from the Snippets folder (important)
<h5 class="product__price uppercase h5{% if current_variant.compare_at_price > current_variant.price %} on-sale{% endif %}">
<span class="money"><span id="ProductPrice-{{ section.id }}">{{ current_variant.price | money }}</span></span>
<p class="small compare-at em" id="ComparePriceWrapper-{{ section.id }}" {% unless current_variant.compare_at_price > current_variant.price %}style="display: none"{% endunless %}>
<span class="money"><span id="ComparePrice-{{ section.id }}">{{ product.compare_at_price_max | money }}</span></span>
</p>
</h5>
@whistlerbrad
whistlerbrad / product-grid-item.liquid
Last active October 31, 2018 22:53
Hide sold out price in Collections
{% unless sold_out %}
<p class="price_wrapper">
<span class="price{% if on_sale %} on-sale{% endif %}">
{% if product.price_varies %}{{ 'products.general.from' | t }} {% endif %}
<span class="money">{{ product.price | money }}</span>
</span>
{% if on_sale %}
<span class="compare-at">
@whistlerbrad
whistlerbrad / Example of price compare
Created October 30, 2018 00:26
Example of price compare
<p class="small compare-at em" id="ComparePriceWrapper-{{ section.id }}" {% unless current_variant.compare_at_price > current_variant.price %}style="display: none"{% endunless %}>
<span class="money"><span id="ComparePrice-{{ section.id }}">{{ product.compare_at_price_max | money }}</span></span>
</p>
@whistlerbrad
whistlerbrad / fonts.liquid
Created October 27, 2018 03:00
Missing in 4.3 - snippets/fonts.liquid
<!-- /snippets/fonts.liquid -->
{% if settings.font_body contains 'google:' or settings.font_accent contains 'google:' or settings.font_title contains 'google:' %}
{{ 'webfont.js' | asset_url | script_tag }}
<script type="text/javascript">
WebFont.load({
google: {
families:
{% capture requestString %}
{% if settings.font_body contains 'google:' %}
{{ settings.font_body | remove: 'google:' | remove: 'sansStack:' | remove: 'serifStack:' }},400italic,700,700italic:latin&