Skip to content

Instantly share code, notes, and snippets.

View nilocortex's full-sized avatar

Nilo Cortex nilocortex

View GitHub Profile
@nilocortex
nilocortex / product-brand-features.liquid
Created February 2, 2021 22:09
product-brand-features.liquid
<!-- /sections/product-brand-features.liquid -->
<!-- Desktop -->
{% for block in section.blocks %}
{% case block.type %}
{% when 'image' %}
{% if block.settings.product-feature != blank %}
{% if block.settings.product-feature == product.handle %}
<div class="grid--full card-shadow {% if block.settings.id == "left" %}feature-flex{% else %}feature-flex-right{% endif %} product-related-items home-reveal">
{% if block.settings.id == 'left' %}
{% if block.settings.image == blank %}
@nilocortex
nilocortex / product-details.liquid
Created June 25, 2020 20:19
Product Notice Code
<!--
ADD THIS BELOW "{% include 'variant-qty-controls', qtyMin:1 %}"
-->
<div class="product--notes">
{{ product.metafields.product_notice.content}}
</div>
@nilocortex
nilocortex / theme.js.liquid
Created June 16, 2020 20:26
Add Variant ID Url switching
$container.on(theme.Variants.eventStrs.onVariantChanged, function (e, variant) {
if (variant) {
if(window.location.pathname.indexOf('product') >= 0){
var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + '?variant=' + variant.id;
window.history.replaceState({path: newurl}, '', newurl);
}
self._changeImage($container, variant);
self._changePrice($container, variant);
self._changeSKU($container, variant);
self._updateAvailability($container, variant.available);
@nilocortex
nilocortex / swatch.liquid
Created April 2, 2020 21:18
Variant image patch - v1.4.8 - v1.4.10
{% comment %}
Set the extension of your color files below. Use 'png', 'jpeg', 'jpg' or 'gif'.
{% endcomment %}
{% assign swatchIndex = index %}
{% assign colPage = collPage %}
{% assign swatchTotal = total %}
{%- assign varGenProd = product -%}
{%- assign mainVariant = varGenProd.selected_or_first_available_variant -%}
{% assign file_extension = 'png' %}
@nilocortex
nilocortex / theme.js
Last active April 2, 2020 20:16
Announcement Bar Fix 1.4.9 - 1.4.10.1
function docSpacing() {
// Init header height script
var hHeight = $("#header").height(),
hPosition = $("#header").data('position'),
mobileSticky = $(".mobile-cart-buttons").data('sticky'),
mobileLocation = $(".sticky-footer").data("mobile"),
mobileNavDiv = $('.sticky-footer'),
mobilehHeight = $(".sticky-footer").height(),
mobileProdBtns = $('.product-top-buttons'),
mobilePromoDiv = $('.promo-bar'),
@nilocortex
nilocortex / theme.js
Created March 18, 2020 15:18
Blank Search Query Patch
initHeader: function (container) {
var self = this;
var $container = $(container);
var isAndroid = navigator.userAgent.indexOf("Android") > -1;
if (isAndroid) {
$('#searchInputMobile', container).focus(function () {
$('body').addClass("fixfixed");
});
$('#searchInputMobile', container).blur(function () {