Skip to content

Instantly share code, notes, and snippets.

View chadleap's full-sized avatar

chad chadleap

  • 16:11 (UTC -04:00)
View GitHub Profile
@kyleboehlen
kyleboehlen / product-options-linked.liquid
Created December 22, 2021 19:36
Shopify Hide Unavailable Variants
<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
// Modified by Jonathan Moore (Style Hatch) https://github.com/jonathanmoore
/*
Updated to work with sectioned themes
- Added required methods from the deprecated options_selection.js
- Triggers an initial variant change
- Hides sold out variants with only one option
@liqtags
liqtags / shopify-liquid-cheatsheet.liquid
Created July 25, 2018 12:03
Shopify Liquid Cheatsheet
Shopify objects that contain attributes that can be dynamically put on the page. For example, the product object contains an attribute called title that can be used to output the title of a product.
The handle is used to access the attributes of a Liquid object. By default, it is the object’s title in lowercase with any spaces and special characters replaced by hyphens (-). Every object in Liquid (product, collection, blog, menu) has a handle.
Collections & Products
Collection ►
all_types ►
Returns a list of all the product types for a collection
@shopifypartners
shopifypartners / related-products-by-tag-group.liquid
Last active July 4, 2023 10:04
Code for section which generates related products based on grouping tags - https://www.shopify.com/partners/blog/related-products
@jonathanmoore
jonathanmoore / gist:c0e0e503aa732bf1c05b7a7be4230c61
Last active January 17, 2024 21:47 — forked from carolineschnapp/gist:1083007
Linked options helper methods for Shopify. See this: http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/linked-product-options - Updated to work with sectioned themes (tested with District)
<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
// Modified by Jonathan Moore (Style Hatch) https://github.com/jonathanmoore
/*
Updated to work with sectioned themes
- Added required methods from the deprecated options_selection.js
- Triggers an initial variant change
- Hides sold out variants with only one option

Body

Medium Font Size Line Height Characters
Print 12pt 1.25em 60-75
Desktop (lg) 1em (16px) 1.375em 60-75
Desktop 1em (16px) 1.375em 60-75
Tablet (lg) 1em (16px) 1.375em 60-75
Tablet (sm) 1em (16px) 1.25em 60-75
Phone 1em (16px) 1.25em 35-40
@zakhardage
zakhardage / Tiered Pricing for Shopify
Last active April 19, 2022 10:53
Shopify tiered pricing using javascript (non-app). This example has the quantity breaks controlled by theme settings.
// config -> settings.html
// Make sure you have the same number of quantity breaks as product variants
<fieldset>
<legend>Quantity Breaks</legend>
<table class="standard-table">
<tr><td>Enter quantity breaks in ascending order separated by a comma (e.g. 5, 10, 20, 50)</td><td><input type="text" name="breaks" size="50" /></td></tr>
</table>
</fieldset>
<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) {