Skip to content

Instantly share code, notes, and snippets.

View ed-codes's full-sized avatar

Eduard Fastovski ed-codes

View GitHub Profile
<style>
/* Method 1: This way doesn't allow them to add a media query. Icon, Flex, and Design Packs use this method.
/* Desktop */
{%- if section.settings.custom_css != blank -%}
{%- assign custom_section_declarations = section.settings.custom_css | split: '}' -%}
{%- for declaration in custom_section_declarations -%}
{%- if declaration contains '{' -%}
@ed-codes
ed-codes / product-inventory.liquid
Created January 13, 2022 12:46
YOUTUBE VIDEO: https://youtu.be/uycL8dxe2C4 | Shopify Dawn Theme: Display Inventory On Product Page, No App
{% if product.variants.first.inventory_quantity < 5 %}
<p>Stock: {{ product.variants.first.inventory_quantity }}</p>
{% endif %}
@ed-codes
ed-codes / webflow-301-script.js
Created July 7, 2021 08:42
Webflow 301 redirects bulk import
var hostingContainer = document.getElementsByClassName('hosting-tab')[0];
var hostingController = angular.element(hostingContainer);
var scope = hostingController.scope();
var redirects = [
{source: '/old1', target: '/new1'},
{source: '/old2', target: '/new2'},
];
redirects.forEach(function (rule) {
@ed-codes
ed-codes / recommended-products.liquid
Last active May 1, 2021 14:54
Recommend / Related products
<!-- Get the overall dominant color of an image to use as pre-lazyload or similar. -->
{% assign dominant_color_image = image | img_url: '1x' %}
<!-- Stretch it out and you basically have an extremeley blurry version of the image. -->
$('[min]').change(function() {
var min = parseInt(jQuery(this).attr('min'));
var value = parseInt(jQuery(this).val());
if (value < min) { jQuery(this).val(min); }
});
<!-- Theme.liquid -->
{% if settings.enable-popup %}
{% include 'subscribe' %}
{% endif %}
<!-- snippets/subscribe.liquid -->
<div class="subscribe-popup mfp-hide">
<h3>{{settings.subscribe-heading}}</h3>
@ed-codes
ed-codes / hreflangs.liquid
Created July 11, 2019 15:47
to avoid duplicate content for localized stores
<link rel="alternate" href="{{ canonical_url }}" hreflang="en-us" />
<link rel="alternate" href="{{ canonical_url | replace: '.com', '.com.au' }}" hreflang="en-au" />
var outboundClick = document.getElementById('js-outboundClick');
outboundClick.addEventListener('click', function(event){
event.preventDefault();
ga('send', 'event', 'Countrypopup', 'click', {
hitCallback: function() {
console.log('event fired');
// window.location.href="eteswimwear.com.au"
When doing something like <!--video-id:abcabc-->
{% assign video-id = collection.description | split: 'video-id:' | last | split: '-->' | first %}
When you need multiple and dont know how many,
Example images for a slider:
{% assign inaction-images = collection.description | split: '<!--endinaction-->' | first | split: '<img' %}