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
export default date => { | |
const monthNames = [ | |
'Jan', | |
'Feb', | |
'Mar', | |
'Apr', | |
'May', | |
'Jun', | |
'Jul', | |
'Aug', |
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
export default (amount, currency) => { | |
const currencies = { | |
AFN: '؋', | |
ARS: '$', | |
AWG: 'ƒ', | |
AUD: '$', | |
AZN: '₼', | |
BSD: '$', | |
BBD: '$', | |
BYR: 'p.', |
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
{% comment %} | |
Get the unix time between today and the date the product was created. | |
If there's less than 30 days (2592008) between the two times display it as new. | |
Note: "times: 1" is used to make sure the timestamp is an int not a string | |
Example usage: | |
{% include 'new_item' with product %} |
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 obj = {}; | |
$('form').find('input, select, textarea').each(function() { | |
obj[this.name] = this.value; | |
}); | |
// Or create an object based on a specific group of form elements | |
var address = {}; | |
$('form').find('[name^="address"]').each(function() { | |
address[this.name.replace('address[','').replace(']','')] = this.value; | |
}); |
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
{{ 0 | money | remove: '0' | remove: '.' | strip_html }} = '£' or whatever currency your shop is set to | |
<!-- WARNING: the following will not work --> | |
{{ shop.currency }} = the 3 letter currency code i.e. 'GBP' but we want the symbol (£) | |
{{ shop.money_format }} = '£{{amount}}' | |
{{ shop.money_format | remove: '{{amount}}' }} = error because of the curly braces | |
{{ shop.money_format | remove: '{' | remove: 'amount' | remove: '}' }} = error (even a single closing curly brace will error) | |
{{ shop.money_format | slice: 1 }} === 's'? | |
{{ shop.money_format | truncate: 1 }} === '...'? |
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
{% comment %} | |
This include requires you to pass in the an article excerpt | |
which contains a single image. | |
Example: {% include 'excerpt_image' with article.excerpt %} | |
{% endcomment %} | |
{% assign src = excerpt_image | split: 'src="' %} |
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
{% assign fulfillment_status = 'unfulfilled' %} | |
{% if line_item.fulfillment.tracking_company > '' %} | |
{% assign fulfillment_status = 'fulfilled' %} | |
{% endif %} |
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 %} |
NewerOlder