Skip to content

Instantly share code, notes, and snippets.

View davelowensohn's full-sized avatar

Dave Lowensohn davelowensohn

View GitHub Profile
@davelowensohn
davelowensohn / config.yml
Created March 23, 2018 21:06
Shopify Slate config.yml
# This file contains the information needed for Shopify to authenticate
# requests and edit/update your remote theme files.
#
# 1. Set up a private app (https://help.shopify.com/api/guides/api-credentials#generate-private-app-credentials)
# with "Read and write" permissions for "Theme templates and theme assets".
# 2. Replace the required variables for each environment below.
#
# password, theme_id, and store variables are required.
#
# For more information on this config file:
@davelowensohn
davelowensohn / related-loop.liquid
Created May 10, 2017 17:46
Shopify liquid fake collection randomizer for related products
@davelowensohn
davelowensohn / gist:98b386c58ba09c00fa552e00a47d93ab
Last active December 6, 2023 17:15 — forked from carolineschnapp/gist:9122054
Order form to use in a page or collection template.
{% comment %}
Source: https://gist.github.com/davelowensohn/98b386c58ba09c00fa552e00a47d93ab
Forked from: https://gist.github.com/carolineschnapp/9122054
If you are not on a collection page, do define which collection to use in the order form.
Use the following assign statement, replace 'your-collection-handle-here' with your collection handle.
{% assign collection = collections.your-collection-handle-here %}
Use the assign statement outside of this comment block at the top of your template.
{% endcomment %}
{% paginate collection.products by 100 %}
@davelowensohn
davelowensohn / product-thumbnail.liquid
Created May 2, 2017 00:38
Shopify canonicalize product into first collection
...
{% if product.collections[0].handle.size > 0 %}
{% assign canonical_url = shop.url | append: '/collections/' | append: product.collections[0].handle | append: '/products/' | append: product.handle %}
{% else %}
{% assign canonical_url = product.url | within: collection %}
{% endif %}
...
@davelowensohn
davelowensohn / collection.withfilters.liquid
Last active March 14, 2023 18:54
Shopify dropdown filters
{% paginate collection.products by 32 %}
<div id="collection-description" class="desktop-12">
<h1>{{ collection.title }}</h1>
{{ collection.description }}
</div>
{% if settings.filters %}
<div id="full-width-filter" class="desktop-12 tablet-6 mobile-3">
{% include 'dropdown-filter' %}
</div>
@davelowensohn
davelowensohn / cart.liquid
Last active February 9, 2017 18:06
Shopify "Final Sale" sticker (for product & cart)
{% if item.product.tags contains 'final-sale' %}
<div class="final-sale-warning">FINAL SALE</div>
{% endif %}
@davelowensohn
davelowensohn / theme.liquid
Created February 9, 2017 08:31
Shopify canonical_url - override with product.collections.last
...
{% if template contains 'product' and product.collections.size > 0 %}
<link rel="canonical" href="{{ shop.url }}{{ product.collections.last.url }}/products/{{product.handle}}" />
{% else %}
<link rel="canonical" href="{{ canonical_url }}" />
{% endif %}
...
@davelowensohn
davelowensohn / routes_retail.js
Created December 21, 2016 19:01
Ember layered async model RSVP hash
model(params){
var allProds = this.store.findAll('product'),
brandsPromise = allProds.then(allProducts => {
var allBrands = allProducts.map( aProd => aProd.get('vendor')),
filteredBrandPromise = new Promise(function (resolve, reject){
resolve( Array.from(new Set(allBrands)).sort());
reject();
});
return filteredBrandPromise;
}
@davelowensohn
davelowensohn / promisemodel.hbs
Last active December 8, 2016 01:37
Hard-fought Ember promise CP that actually resolves in template
{{model.allVariantsQty.value}}
@davelowensohn
davelowensohn / components.validated-field.js
Last active October 21, 2016 01:02
ember-changeset rollback issue
import Ember from 'ember';
export default Ember.Component.extend({
});