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:6081278
Last active June 21, 2021 20:45
Example where customer tags are collected in the REGISTRATION form, and more than one tag. The server expects a comma-separated list of tags. So we give that list to him via a hidden input field that we update with JavaScript. In the SIGNUP form, it'd be the same code except you replace customer[tags] with contact[tags].
<p>I am interested in:</p>
<p>
<input type="checkbox" class="interested-in" value="sunsets">Sunsets<br />
<input type="checkbox" class="interested-in" value="piña coladas">Piña coladas<br />
<input type="checkbox" class="interested-in" value="getting lost in the rain">Getting lost in the rain<br />
<input type="checkbox" class="interested-in" value="songs by rupert holmes">Songs by Rupert Holmes<br />
</p>
<!-- this is what is submitted to the server -->
<input type="hidden" name="customer[tags]" />
@carolineschnapp
carolineschnapp / gist:5686905
Created May 31, 2013 18:23
Minimal drop-downs that work with non-English characters.
<!-- snippets/dropdown.liquid -->
{% if settings.navigation_alignment == "right" %}
<ul class="horizontal fr unstyled clearfix">
{% endif %}
{% if settings.navigation_alignment == "below" %}
<ul class="horizontal unstyled clearfix">
{% endif %}
{% for link in linklists.main-menu.links %}
@carolineschnapp
carolineschnapp / gist:5397337
Last active January 20, 2023 10:11
Sample JavaScript file added with ScriptTag resource. This sample file is meant to teach best practices. Your app will load jQuery if it's not defined. Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
/* Sample JavaScript file added with ScriptTag resource.
This sample file is meant to teach best practices.
Your app will load jQuery if it's not defined.
Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
Your app does not change the definition of $ or jQuery outside the app.
Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2'
once the app is installed, even if the app uses jQuery 1.9.1:
jQuery.fn.jquery => "1.4.2"
$.fn.jquery -> "1.4.2"
*/
<!--[if IE 8]>
<style>
/* CSS here that you apply to mobile devices */
</style>
<![endif]-->
@carolineschnapp
carolineschnapp / gist:5135026
Created March 11, 2013 15:28
[Minimal] Within the product description editor, or the page editor, switch to the HTML view by clicking on "View HTML" at the top right. You then need to use the following code, while taking note of the instructions in the comments.
<!-- This is your tab navigation -->
<ul class="tabs">
<li><a class="active" href="#tab1">Sample Tab One</a></li>
<!-- The key here is that the href ID equals the <li> ID used below -->
<li><a href="#tab2">Sample Tab Two</a></li>
<li><a href="#tab3">Sample Tab Three</a></li>
</ul>
<!-- This is your tab content -->
<ul class="tabs-content">
@carolineschnapp
carolineschnapp / gist:4088729
Created November 16, 2012 16:30
Lightbox all the things
<script>
jQuery(function() {
jQuery('.rte img').not('a > img').each(function() {
// Matching images that aren't already shown in their original size.
var re = /(_small)|(_compact)|(_medium)|(_large)|(_grande)/;
var src = jQuery(this).attr('src');
if (re.test(src)) {
// Determining the URL to the original image.
var href = src.replace(re, '');
// Activating lightbox.
@carolineschnapp
carolineschnapp / gist:3452433
Last active March 18, 2022 05:08
product.liquid in New Standard Theme after the swatches "wash"
<div class="clearfix" id="product-content" itemscope itemtype="http://schema.org/Product">
<meta itemprop="url" content="{{ shop.url }}{{ product.url }}" />
<meta itemprop="image" content="{{ product.featured_image.src | product_img_url: 'grande' }}" />
{% if product.available %}
<form action="/cart/add" method="post" enctype="multipart/form-data">
{% endif %}
<ul id="product-details">
@carolineschnapp
carolineschnapp / gist:3452112
Created August 24, 2012 15:41
swatches.liquid
<style>
/* Hiding the drop-downs. */
#product-variants, .selector-wrapper { display:none; }
/* Style the swatches */
#swatches { margin:20px 0 0; }
.swatch { margin:15px 0; }
.swatch ul { list-style-type:none; margin:0; padding:0; }
.swatch li {
@carolineschnapp
carolineschnapp / gist:3429052
Created August 22, 2012 20:25
product.monogram-with-inventory-on-the-flask.liquid
<div class="clearfix" id="product-content" itemscope itemtype="http://schema.org/Product">
<meta itemprop="url" content="{{ shop.url }}{{ product.url }}" />
<meta itemprop="image" content="{{ product.featured_image.src | product_img_url: 'grande' }}" />
<form action="/cart/add" method="post" enctype="multipart/form-data">
<ul id="product-details">
<li id="product-title">
@carolineschnapp
carolineschnapp / gist:3351324
Created August 14, 2012 18:05
Lots of filters
<!-- Step 1: Add your filters -->
<!-- The collection filter is entirely optional -->
<!-- You can have as many as 3 of the product tags filters -->
<ul class="clearfix">
<li class="clearfix filter">
<p>Shop by category</p>
<select class="coll-picker">
<option value="all">All</option>
{% for c in collections %}