This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
This include requires you pass in two variables. | |
{{ add }}: The address being listed | |
{{ edit }}: Boolean value if the address can be edited on this page | |
Example: | |
{% for address in customer.addresses %} | |
{% include 'address_summary', add: address, edit: true %} | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- add the options +tags to the listed products attributes --> | |
{% if p.options[0] == 'Color' %}{% capture colours %}{% for variant in p.variants %}{% unless forloop.first %},{% endunless %}{{ variant.options[0] }}{% endfor %}{% endcapture %}{% endif %} | |
{% if p.options[1] == 'Material' %}{% capture materials %}{% for variant in p.variants %}{% unless forloop.first %},{% endunless %}{{ variant.options[1] }}{% endfor %}{% endcapture %}{% endif %} | |
{% if p.options[2] == 'Style' %}{% capture styles %}{% for variant in p.variants %}{% unless forloop.first %},{% endunless %}{{ variant.options[2] }}{% endfor %}{% endcapture %}{% endif %} | |
{% if p.tags %}{% capture tagg %}{% for tag in p.tags %}{% if tag contains 'recommended:' %}{% unless forloop.first %},{% endunless %}{{ tag | replace: 'recommended:', '' }}{% endif %}{% endfor %}{% endcapture %}{% endif %} | |
<div class="product" data-colours="{{ colours | escape }}" data-materials="{{ materials | escape }}" data-styles="{{ styles | escape }}" data-tags="{{ tagg | esc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
Get a products sale percentage based off it's compare_at_price vs it's price | |
Example usage: | |
{% include 'sale_percentage' with product %} Off | |
Outputs for a product with a compare at price of £10 and a price of £5: | |
"50% Off" | |
{% endcomment %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.imgURL = function(size) { | |
// remove any current image size then add the new image size | |
return this | |
.replace(/_(pico|icon|thumb|small|compact|medium|large|grande|original|1024x1024|2048x2048|master)+\./g, '.') | |
.replace(/\.jpg|\.png|\.gif|\.jpeg/g, function(match) { | |
return '_'+size+match; | |
}) | |
; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
a new template will need to be created for this file then this will | |
be what's called from the ajax by sending it with a property of | |
view:*template name*. | |
--> | |
{% layout none %} | |
{% paginate items by 5 %} | |
{% for item in items %} | |
<!-- item html --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add multiple items to the cart by passing an array of item objects | |
function addItems(items, callback) { | |
if(!items.length) { | |
// we ran out of items | |
if(typeof callback === 'function') callback(); | |
return; | |
} | |
$.ajax('/cart/add.js', { | |
type:'POST', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Cart = (function($, Shopify) { | |
var list = '.sproducts'; | |
var total = '.shoppingbag-total'; | |
function updateTotal() { | |
Shopify.getCart(function(data) { | |
$(total).text(Shopify.formatMoney(data.total_price, '£\{\{amount}}')); | |
}); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ul { | |
list-style: none; | |
padding-left: 1.1225em; | |
} | |
ul li { | |
position: relative; | |
padding-bottom: 3px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.extend({ | |
readMore: function(truncate) { | |
return this.each(function() { | |
var $self = $(this); | |
var originalText = $self.text(); | |
if(originalText.length<=truncate) return; | |
$self.text($.trim(originalText).substring(0, truncate)); | |
NewerOlder