Skip to content

Instantly share code, notes, and snippets.

View carolineschnapp's full-sized avatar

Caroline carolineschnapp

  • Shopify
  • Montreal
View GitHub Profile
@carolineschnapp
carolineschnapp / gist:1082821
Created July 14, 2011 16:38
Search box with placeholder text for Shopify
<form action="/search" method="get" id="search">
<p>
<label class="move" for="searchtext">Search</label>
<input type="search" id="searchtext" name="q" placeholder="Search" />
<input type="image" id="searchbutton" src="{{ 'icon-search.gif' | asset_url }}" alt="Search" />
</p>
</form>
<style>
#search p {
<script>
// (c) Copyright 2016 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com
// See https://docs.shopify.com/themes/customization/navigation/link-product-options-in-menus
var Shopify = Shopify || {};
Shopify.optionsMap = {};
Shopify.updateOptionsInSelector = function(selectorIndex) {
@carolineschnapp
carolineschnapp / fields.liquid
Created August 26, 2011 05:18
Custom form fields for our decal product
<p>
<label for="color">Color</label>
<select id="color" required>
<option value="">
Select a color
</option>
<option value="Maroon">
Maroon
</option>
<option value="Razzmatazz">
@carolineschnapp
carolineschnapp / gist:1273086
Created October 9, 2011 00:14
debug-panel.liquid
<div id="shopify-product-customization-help">
<h6 class="title">Product Customization Help</h6>
<ul class="links">
<li>
<a class="clear-attributes" href="#" title="Clear all customization attributes" onclick="Shopify.Customizr.clearAttributes();return false;">Clear attributes</a>
</li>
<li>
<a class="inspect-attributes" href="#" title="Inspect attributes" onclick="Shopify.Customizr.inspectAttributes('attributes-wrapper');return false;">Inspect attributes</a>
</li>
<li>
@carolineschnapp
carolineschnapp / gist:1364745
Created November 14, 2011 18:50
In email templates to know if order only consisted in downloads
{% assign nothing_but_downloads = true %}
{% for line in line_items %}
{% if nothing_but_downloads == true and line.variant.requires_shipping == true %}
{% assign nothing_but_downloads = false %}
{% endif %}
{% endfor %}
{% if nothing_but_downloads %}
SPECIAL CONTENT
@carolineschnapp
carolineschnapp / product.liquid
Created November 18, 2011 20:16
Fix for On the Go theme
<!-- BEFORE -->
var selectCallback = function(variant, selector) {
if (variant && variant.available == true) {
// selected a valid variant
jQuery('#add-to-cart').removeClass('disabled').removeAttr('disabled'); // remove unavailable class from add-to-cart button, and re-enable button
if(variant.price < variant.compare_at_price){
jQuery('#price-preview').html(Shopify.formatMoney(variant.price, "{{ shop.money_format }}") + "<del>" + Shopify.formatMoney(variant.compare_at_price, "{{ shop.money_format }}") + "</del>");
} else {
jQuery('#price-preview').html(Shopify.formatMoney(variant.price, "{{ shop.money_format }}"));
@carolineschnapp
carolineschnapp / index.liquid
Created November 18, 2011 20:49
Expo theme bug fix in index.liquid
<!-- In index.liquid -->
<!-- BEFORE -->
{% for product in collections[settings.frontpage_collection].products limit:8 %}
<!-- FIXED -->
{% for product in collections[settings.frontpage_collection].products limit: settings.frontpage_pagination_limit %}
<ul>
<li{% unless current_tags %} class="active"{% endunless %}>
{% if collection.handle %}
<a href="/collections/{{ collection.handle }}">All</a>
{% elsif collection.products.first.type == collection.title %}
<a href="{{ collection.title | url_for_type }}">All</a>
{% elsif collection.products.first.vendor == collection.title %}
<a href="{{ collection.title | url_for_vendor }}">All</a>
{% endif %}
@carolineschnapp
carolineschnapp / gist:1573451
Created January 7, 2012 01:51
customer/login.liquid
{% layout settings.customer_layout %}
<div id="template">
<div id="customer">
<div class="template_header">
<h2 class="title">Customer Login</h2>
</div>
{% form 'customer_login' %}
{{ form.errors | default_errors }}
A
{{ "/services/javascripts/currencies.js" | script_tag }}
B
{{ "currencies.js" | asset_url | script_tag }}