Skip to content

Instantly share code, notes, and snippets.

@bradjmiller
bradjmiller / cart-snippet.liquid
Created March 1, 2012 01:45
Display associated image of product variant in cart.liquid
<a href="{{ item.product.url }}" title="{{ item.product.title | escape }}">
{% assign found = false %}
{% for img in item.product.images %}
{% if found == false and item.variant.title contains img.alt %}
<img src="{{ img | product_img_url: 'thumb' }}" alt="{{ item.alt | escape }}" />
{% assign found = true %}
{% endif %}
{% endfor %}
{% if found == false %}
<img src="{{ item.product.featured_image | product_img_url: 'thumb' }}" alt="{{ item.product.featured_image.alt | escape }}" />
@bradjmiller
bradjmiller / 0_reuse_code.js
Created October 5, 2016 20:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console