Skip to content

Instantly share code, notes, and snippets.

View carolineschnapp's full-sized avatar

Caroline carolineschnapp

  • Shopify
  • Montreal
View GitHub Profile
@carolineschnapp
carolineschnapp / cart-ext.liquid
Created May 4, 2011 21:11
Limit to 1 — add at the bottom of cart.liquid
<script>
if (typeof jQuery === 'undefined') {
document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"><\/script>');
document.write('<script type="text/javascript">jQuery.noConflict();<\/script>');
}
</script>
<script type="text/javascript">
jQuery(function() {
var needs_update = false;
@carolineschnapp
carolineschnapp / gist:993663
Created May 26, 2011 18:04
Holy Grail for buy section in product.liquid
{% if product.available %}
<form method="post" action="/cart/add">
{% if product.variants.size > 1 %}
<!-- START LISTING VARIANTS -->
<select name="id" id="product-select">
{% for variant in product.variants %}
{% if variant.available %}
<option value="{{ variant.id }}">{{ variant.title }} ({{ variant.price | money }})</option>
@carolineschnapp
carolineschnapp / gist:994755
Created May 27, 2011 06:31
Product images path
var path = "{{ 'products/retarded.jpg' | product_img_url: "original" | remove: 'products/retarded.jpg' | replace: '?', ' ' | truncatewords: 1, '' }}";
@carolineschnapp
carolineschnapp / related-products.liquid
Last active December 22, 2022 21:29
Related Products — to add to product.liquid
@carolineschnapp
carolineschnapp / gist:1002949
Last active October 12, 2023 09:32
Related Products by Tags — to add to product.liquid
<!-- Solution brought to you by Caroline Schnapp -->
<!-- See this: http://wiki.shopify.com/Related_Products -->
{% assign image_size = 'compact' %}
{% assign heading = 'Other fine products' %}
{% if product.tags.size > 0 %}
<h3>{{ heading }}</h3>
<ul class="related-products"></ul>
@carolineschnapp
carolineschnapp / gist:1003334
Created June 1, 2011 21:10
Related Products using metafields - to add to product.liquid
<!-- Solution brought to you by Caroline Schnapp -->
<!-- See this: http://wiki.shopify.com/Related_Products -->
{% assign image_size = 'compact' %}
{% assign heading = 'Other fine products' %}
{% if product.metafields.recommendations.productHandles %}
<h3>{{ heading }}</h3>
<ul class="related-products"></ul>
{{ article.created_at | date: '%B, %d %Y' | replace: 'January', 'Januar' | replace: 'February', 'Februar' | replace: 'March', 'Marts' | replace: 'May', 'Maj' | replace: 'June', 'Juni' | replace: 'July', 'Juli' | replace: 'October', 'Oktober' }}
@carolineschnapp
carolineschnapp / gist:1012997
Created June 7, 2011 19:51
Product Image Caption that uses the image filename
{% capture caption %}{{ image | remove: "products/" | remove: ".jpeg" | remove: ".jpg" | remove: ".png" | handleize | replace: "-", " " | replace: "_", " " | capitalize }}{% endcapture %}
@carolineschnapp
carolineschnapp / gist:1014941
Created June 8, 2011 17:59
tiered-pricing.liquid
<script>
if (typeof jQuery === 'undefined') {
document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"><\/script>');
document.write('<script type="text/javascript">jQuery.noConflict();<\/script>');
}
</script>
{% if needs_update %}
<script type="text/javascript">
jQuery('form[action="/cart"]').get(0).submit();
@carolineschnapp
carolineschnapp / gist:1082440
Created July 14, 2011 13:24
Twitter button
{{ 'my-twitter-button.png' | asset_url | img_tag | link_to: 'http://twitter.com/iamawesome', 'follow me on twitter' }}