Skip to content

Instantly share code, notes, and snippets.

View stefbowerman's full-sized avatar

Stefan Bowerman stefbowerman

View GitHub Profile
@stefbowerman
stefbowerman / strip_iframe_from_product_description.liquid
Last active March 23, 2017 17:14
Strip the last embedded iframe from a Shopify product description using liquid. This is helpful if a store wants to use a custom video per product, just use the 'embed video' button on the WYSIWYG editor and this code will take care of the rest.
<!--
Strip the last embedded iframe from a Shopify product description using liquid.
This is helpful if a store wants to use a custom video per product (without the img alt tag hack)
Just use the 'embed video' button on the WYSIWYG editor and this code will take care of the rest.
Place code in product.liquid
This snippet will turn this -
<p>Here's my description</p>
<p><iframe src="https://youtube.com..." /></p>
  • Copy paste all emails
  • Close video once it ends
  • Make legal template
  • Check cart note, if you add one and go to another page and then go back the button still defaults to "is this a gift?"
  • Cart template - option to change the note
  • Add open graph photos for sharing
/*
* AjaxChimp Lite
* ===================
*
* Example Usage:
*
* var opts = {
* onInit: function(){ console.log('I'm initialized!'); }
* };
*
<--
You need to add a select tag everywhere you loop through variants
Basically, there has to be an option on the page for every variant
You could loop through all of them at once and have one select tag but that might not work with the tabs / markup
-->
.
.
.
{% if has_men_sizes > 0 %}
@stefbowerman
stefbowerman / Dormify.md
Last active September 22, 2017 02:58
Super Swatch Breakdown

Dormify Swatch Breakdown

Product Tags

Using product tags structured like data-{key}:{value}. This allows easy splitting and manipulation within liquid templates.

"data--apt:APT"
"data--color:Light Blue"
"data--color:Purple"
"data--sub-category:Decorative Pillows"
This file has been truncated, but you can view the full file.
{
"assets": [
],
"content": {
"description": {
"value": "Sweat through the season in technical tees, shorts, and sweats for any activity."
},
"name": {
"value": "Shop Men"

Migrating simple / configurable products

All configurable products need to be imported over. All simple products with no associated configurable product need to be imported over. All simple products with an associated configurable product (these will be invisible to catalog / search on Magento) need to be added as variants to that configurable product inside Shopify.

Magento Product descriptions need to be parsed and split into 4 fields (if possible):

  • Description
  • Metafields.details_fabric
  • Metafields.details_detailing
  • Metafields.details_model
{% if template.name == "collection" %}
{% comment %}
// COLLECTION FILTERING
=====================
We're using prefixing to categorize our tags
- Color - prefixed with "Color:"
- Size - prefixed with "Size:"
var snowStorm = function(t, e) {
function i(t, e) {
return isNaN(e) && (e = 0),
Math.random() * t + e
}
function n(t) {
return 1 === parseInt(i(2), 10) ? t * -1 : t
}
function o() {
t.setTimeout(function() {
function globalNavDropdowns(t) {
var n = this;
this.container = document.querySelector(t),
this.root = this.container.querySelector(".navRoot"),
this.primaryNav = this.root.querySelector(".navSection.primary"),
this.primaryNavItem = this.root.querySelector(".navSection.primary .rootLink:last-child"),
this.secondaryNavItem = this.root.querySelector(".navSection.secondary .rootLink:first-child"),
this.checkCollision(),
window.addEventListener("load", this.checkCollision.bind(this)),
window.addEventListener("resize", this.checkCollision.bind(this)),