Skip to content

Instantly share code, notes, and snippets.

@jconnoll
jconnoll / gist:1436411
Created December 6, 2011 02:23
Shopify - In product page get the collection it's in
{% for link in linklists[settings.sidebar_linklist_1].links %}{% for p in collections[link.object.handle].products %}{% if p.title == product.title %}{% assign: collectionName = link.object.handle %}{% endif %}{% endfor %}{% endfor %}
{% for link in linklists[settings.sidebar_linklist_1].links %}
<li><a href="{{ link.url }}"{% if link.url == active_url %} class="current"{% endif %}{% if template == 'article' and link.url == blog.url %} class="current"{% endif %}{% if collection.url == link.url %} class="current"{% endif %}
{% if link.handle == collectionName %} class="current"{% endif %}
>{{ link.title }}</a></li>
{% endfor %}
@jconnoll
jconnoll / gist:1279884
Created October 12, 2011 00:30
Shopify - Facebook share thumbnail
<meta property="og:site_name" content="{{ shop.name }}" />
{% if template == 'product' %}
<meta property="og:image" content="{{ product.featured_image | product_img_url: 'compact' }}" />
{% else %}
<meta property="og:image" content="http://cdn.shopify.com/s/files/1/0070/2452/t/1/assets/logo.png?101693" />
{% endif %}
@jconnoll
jconnoll / gist:1230826
Created September 21, 2011 00:26
Shopify display Variant prices on Specific pricing Collections
{% if collection.handle == "325-475" %}
{% for variant in product.variants %}
{% if variant.price >= 32500 and variant.price <= 47500 %}
<br><span class="collection-size">{{ variant.title }}</span>
<span class="collection-price">{{ variant.price | money }}</span></h4>
{% endif; %}
{% endfor %}
{% elsif collection.handle == "500-and-up" %}
{% for variant in product.variants %}
{% if variant.price >= 50000 %}
@jconnoll
jconnoll / gist:1215643
Created September 14, 2011 01:29
Shopify - Get Count of Products in Collection from Linklist
{% for link in linklists.clothing.links %}
{% paginate link.object.products by 9999 %}
COUNT: {{ link.object.all_products_count }} <br>
{% endpaginate %}
{% endfor %}
@jconnoll
jconnoll / Linklist-with-first-image.liquid
Created September 6, 2011 16:37
Shopify Snippet - Linklist with Images (ala Category Display)