Skip to content

Instantly share code, notes, and snippets.

View andreibabor's full-sized avatar

Andrei Babor andreibabor

View GitHub Profile
@andreibabor
andreibabor / currencies.liquid
Created November 9, 2017 15:55 — forked from sadiesaurus/currencies.liquid
currencies.liquid
{% if settings.show_multiple_currencies %}
{{ "//cdn.shopify.com/s/javascripts/currencies.js" | script_tag }}
<script>
window.onload = function() {
Currency.format = '{{ settings.currency_format | default: 'money_with_currency_format' }}';
var shopCurrency = '{{ shop.currency }}';
/* Sometimes merchants change their shop currency, let's tell our JavaScript file */
Currency.moneyFormats[shopCurrency].money_with_currency_format = {{ shop.money_with_currency_format | strip_html | json }};
@andreibabor
andreibabor / shopify loop first section 7 products, and last 8products new sections .txt
Last active November 21, 2017 16:35
shopify loop first section 7 products, and last 8products new sections
{% comment %}<h3>First 7 products</h3>
<ul>
{% for product in collections.products.products limit:7 %}
<li><a href="{{ product.url }}">{{ product.title }}</a></li>
{% endfor %}
</ul>
<h3>8 and up</h3>
<ul>
{% for product in collections.products.products offset:7 %}
<li><a href="{{ product.url }}">{{ product.title }}</a></li>
@andreibabor
andreibabor / Shopify 3 Multi-levels Menu.txt
Last active November 21, 2017 16:35
Shopify 3 Multi-levels Menu
<ul>
{% for link in linklists.women.links %}
{% assign child_list_handle = link.title | handle %}
{% if linklists[child_list_handle] and linklists[child_list_handle].links.size > 0 %}
<li class="has-dropdown">
{{ link.title | link_to: link.url }}
<ul>
{% for child_link in linklists[child_list_handle].links %}
{% assign grand_child_list_handle = child_link.title | handle %}
{% if linklists[grand_child_list_handle] and linklists[grand_child_list_handle].links.size > 0 %}
@andreibabor
andreibabor / getDiscountCode.html
Last active November 21, 2017 17:00 — forked from ccashwell/getDiscountCode.html
Shopify Discout code Autofill via URL
<script>
/* Put this in theme.liquid, preferably right before "</body>" */
(function() {
var discountParam = document.location.search.match(/discount=(\w+)/);
if (discountParam && discountParam.length > 1) {
document.cookie = discountParam[0];
}
})();
</script>
@andreibabor
andreibabor / Shopify extract first word from a string = collection.handle
Created November 29, 2017 08:08
Shopify extract first word from a string = collection.handle
{% assign my_subcollection = collection.handle %}
{% assign stringSplit = my_subcollection | split:'-' %}
{% for stringPart in stringSplit %}
{%if forloop.first == true %}
<span>{{ stringPart | strip }}</span>
{%endif%}
{% endfor %}
{% comment %}
To add a companion product to the cart automatically if a primary product is in cart:
1. Create a new link list under your Navigation tab.
2. In that link list, make the first link point to companion product.
3. Copy your link list handle where indicated at line 9
4. Set the minimum cart total required for the bonus product on line 10
{% endcomment %}
{% assign linklist = linklists['put-your-link-list-handle-here'] %}
{% assign min_total = 100 %}
@andreibabor
andreibabor / gist:cdf52f60eac31d58c99e786ff5368d41
Last active January 4, 2018 09:26
Script - show my IP Address
<script type="application/javascript">
function getIP(json) {
alert("My public IP address is: " + json.ip);
}
</script>
<script type="application/javascript"
src="http://api.ipify.org?format=jsonp&callback=getIP">
</script>
<!-- END: IP Stuff -->
@andreibabor
andreibabor / gist:85fe7334e2ba764ea215f99a84ffd6c5
Created December 28, 2017 13:28
wordpress install font awesome on sage
bower install --save fontawesome
gulp
gulp watch
plus inserare overrides
{
"name": "sage",
"homepage": "https://roots.io/sage/",
"authors": [
https://apps.shopify.com/wishy
@andreibabor
andreibabor / Wordpress: how insert other js, css files in sage
Last active August 21, 2020 06:23
Wordpress: how insert other js, css files in sage
Important: putem instal asa: bower install Chart.js --save.
sau pasii mai jos:
1.modifam assets/manifest.json iar la linia 22 punem codul
"slick-carousel.js": {
"files": ["../bower_components/slick-carousel/slick/slick.js"],
"main": true
},
"slick-carousel.css": {
"files": ["../bower_components/slick-carousel/slick/slick.css"],