Skip to content

Instantly share code, notes, and snippets.

View ed-codes's full-sized avatar

Eduard Fastovski ed-codes

View GitHub Profile
@ed-codes
ed-codes / all-products.liquid
Last active April 29, 2024 14:40
Access all products in Shopify for loop - (bypass the forloop 50 iterations limit)
{% paginate collections.all-products.products by 1000 %}
{% for product in collections.all-products.products %}
{% endfor %}
{% endpaginate %}
@ed-codes
ed-codes / favicons
Last active August 29, 2015 14:16
Favicons
<link rel="icon" href="{{ 'favicon.png' | asset_url }}">
<!--[if IE]><link rel="shortcut icon" href="{{ 'favicon.ico' | asset_url }}"><![endif]-->
<meta name="msapplication-TileColor" content="#FFFFFF">
<meta name="msapplication-TileImage" content="{{ 'tileicon.png' | asset_url }}">
<!-- For non-Retina (@1× display) iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon-precomposed" href="{{'apple-touch-icon-precomposed.png' | asset_url }}"><!-- 57×57px -->
<!-- For the iPad mini and the first- and second-generation iPad (@1× display) on iOS ≤ 6: -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="{{'apple-touch-icon-72x72-precomposed.png' | asset_url }}">
<!-- For the iPad mini and the first- and second-generation iPad (@1× display) on iOS ≥ 7: -->
<div class="product-description rte" itemprop="description">
{% if product.description contains '<!--split-->' %}
{% assign descriptions = product.description | split: '<!--split-->' %}
{% for section in descriptions %}
{% if section contains '<!--drop-->' %}
@ed-codes
ed-codes / indexing-page-content.js
Created April 12, 2017 03:22
used in Shopify - create index at top of a static page from heading tags, scroll to headings.
jQuery(function() {
var $headings = jQuery('.page-content').find('h2,h4');
var $anchor_list = jQuery('<ul class="anchor-list"></ul>');
var idx = 1;
var $list_item;
$headings.each(function() {
jQuery(this).prepend('<a id="link-' + idx + '"></a>');
$list_item = jQuery('<li></li>');
if (jQuery(this).prop("tagName") == 'H4') {
$list_item.addClass('sub-item');
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "{{ product.title }}",
"image": [
"{{ product.featured_image }}"
],
"description": "{{ product.description | replace: '"', '\"' }}",
"mpn": "{{ product.variants.first.sku }}",
@ed-codes
ed-codes / page-athletes-template.liquid
Last active August 15, 2018 16:58
Athletes listing page for Fusion Multisport
<div class="athlete-tabs">
{% for block in section.blocks %}
<a href="#{{ block.settings.athlete-name | handleize }}" class="athlete-tab">
<span>{{ block.settings.athlete-name }}</span>
<img class="flag" src="{{ block.settings.athlete-flag | img_url: '20x14' }}" alt="{{ block.settings.athlete-country }}">
</a>
{% endfor %}
</div>
@ed-codes
ed-codes / unisex-collections.liquid
Last active September 12, 2018 14:36
Unisex products, Use the women's variant image as featured image on the womens collection page and vice versa for mens
{% for variant in product.variants %}
{% if variant.title contains "Men's"%}
{% if variant.image.src %}
{% comment %}male model shot exists. Display it.{% endcomment %}
{% assign male_image = variant.image %}
{% else %}
{% comment %}male model shot doesnt exist. Display the second image (most likely the flatlay).{% endcomment %}
{% if product.images > 1 %}
{% assign male_image = product.images[1] %}
@ed-codes
ed-codes / blocks-products.liquid
Last active September 12, 2018 15:40
inside product template - link block settings to a specific product, allows varied content
{% for block in section.blocks %}
{% comment %}if this is the correct block for this product page{% endcomment %}
{% if block.settings.mala-product == product.handle %}
{% assign intro-heading = block.settings.page-title %}
{% assign intro-text = block.settings.intro-text %}
{% assign mala-box-1 = block.settings.mala-box-1 %}
{% assign mala-box-2 = block.settings.mala-box-2 %}
{% assign mala-box-3 = block.settings.mala-box-3 %}
@ed-codes
ed-codes / tag-based-size-guides.liquid
Created September 17, 2018 09:56
Show a png image based on product tags with a matching name. e.g. tag a product with 'mens-crew-neck-size-guide' to display a png of the same name.
<section class="item" id="tab-2" data-title="Size Guides">
<div class="item-content">
{% for tag in product.tags %}
{% if tag contains 'size-guide'%}
{% capture tagImage %}{{tag}}.png{% endcapture %}
<img class="size-guide" src="{{ tagImage | asset_img_url: '1200x' }}" width="700" alt="{{ tag }}">
{% endif %}
{% endfor %}
</div>
</section>
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"productID": "{{ product.id }}",
"name": "{{ product.title }}",
"description": "{{ page_description | escape }}",
"url":"{{ product.url }}",
"image": "http:{{ product.featured_image | img_url:'800x' }}",
"brand": "BackPack Buddha",