├── Generate Random number
└── change shipping names.liquid
├── Price Per Unit
├── product-template-price.liquid.txt
└── theme.js
├── README.md
├── Register account with address
└── account.new-address.liquid
├── Stop Clone Websites
└── stop-clone-sites.js
├── change shipping names
├── README
└── change shipping names.js
├── loop-through-linklist
└── section-custom-css
└── custom-schema.liquid
/Generate Random number/change shipping names.liquid:
--------------------------------------------------------------------------------
1 | {%- comment -%}
2 | add {% render 'random-number' %}
3 | {{ random_number }} -> here's your random number
4 | {%- endcomment -%}
5 |
6 | {%- assign min = 0 -%}
7 | {%- assign max = 9999999 -%}
8 | {%- assign diff = max | minus: min -%}
9 | {%- assign random_number = "now" | date: "%N" | modulo: diff | plus: min -%}
--------------------------------------------------------------------------------
/Price Per Unit/product-template-price.liquid.txt:
--------------------------------------------------------------------------------
1 | {%- when 'price' -%}
2 |
3 | {%- assign hide_sale_price = true -%}
4 | {%- if product.compare_at_price_max > product.price -%}
5 | {%- if current_variant.compare_at_price > current_variant.price -%}
6 | {%- assign hide_sale_price = false -%}
7 | {%- endif -%}
8 |
12 | {{ 'products.general.regular_price' | t }}
13 |
14 |
15 |
16 | {%- if current_variant.compare_at_price > current_variant.price -%}
17 | {{ current_variant.compare_at_price | money }}
18 | {%- endif -%}
19 |
20 |
21 |
{{ 'products.general.sale_price' | t }}
22 | {%- else -%}
23 |
{{ 'products.general.regular_price' | t }}
24 | {%- endif -%}
25 |
26 |
28 | {%- unless product.empty? -%}
29 | {{ current_variant.price | money }}
30 | {%- else -%}
31 | {{ 1999 | money }}
32 | {%- endunless -%}
33 |
34 | {% if product.metafields.custom.quantity != blank %}
35 |
{{ current_variant.price | divided_by: product.metafields.custom.quantity | money }}/unit
36 | {% endif %}
37 |
38 |
39 |
40 | {% for variant in product.variants %}
41 | {% if variant.metafields.custom.variant_quantity != blank %}
42 |
45 | {{ current_variant.price | divided_by: variant.metafields.custom.variant_quantity | money }}
46 | per {% if variant.metafields.custom.unit_word_place == blank %}unit{% endif %}{% if variant.metafields.custom.unit_word_place != blank %}{{ variant.metafields.custom.unit_word_place }}{% endif %}
47 | {% endif %}
48 | {% endfor %}
49 |
50 |
51 |
--------------------------------------------------------------------------------
/Price Per Unit/theme.js:
--------------------------------------------------------------------------------
1 | _updateUnitPrice: function(variant) {
2 | document.querySelectorAll("span.perunit").forEach(function(el){
3 | el.style.display = 'none';
4 | });
5 | document.querySelector("span[data-variant-id='"+variant.id+"']").style.display = "inline";
6 | if (this.currentVariant && variant.unit_price === this.currentVariant.unit_price) {
7 | return;
8 | }
9 |
10 | this.container.dispatchEvent(new CustomEvent('variantUnitPriceChange', {
11 | detail: {
12 | variant: variant
13 | }
14 | }));
15 | },
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # notch-shopify-snippets
2 |
3 | This repository is a collection of useful, time-saving shortcuts that help you streamline your Shopify theme development process.
4 |
--------------------------------------------------------------------------------
/Register account with address/account.new-address.liquid:
--------------------------------------------------------------------------------
1 | {% assign formID = "" %}
2 | {% if formInfo.id %}
3 | {% assign formID = formInfo.id | prepend: "_"%}
4 | {% endif %}
5 |
6 | {% form 'customer_address', formInfo %}
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | {% if isNew %}
32 |
39 |
46 | {% else %}
47 |
54 |
61 | {% endif %}
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | {% capture defaultAddressID %}
72 | {% if isNew %}
73 | address_default_address_new
74 | {% else %}
75 | address_default_address{{ formID }}
76 | {% endif %}
77 | {% endcapture %}
78 |
84 |
85 |
86 |
87 | {% unless isNew %}
88 |
89 | {% endunless %}
90 | {% if customer.addresses.size > 0 and isNew %}
91 |
92 | {% endif %}
93 |
94 | {% endform %}
95 |
--------------------------------------------------------------------------------
/Stop Clone Websites/stop-clone-sites.js:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/change shipping names/README:
--------------------------------------------------------------------------------
1 | Add to checkout scripts
2 |
--------------------------------------------------------------------------------
/change shipping names/change shipping names.js:
--------------------------------------------------------------------------------
1 | Input.shipping_rates.each do |shipping_rate|
2 | next unless shipping_rate.name == "UPS Ground"
3 | shipping_rate.change_name("Standard Shipping", message: "Change name from Ground to Standard Shipping")
4 | end
5 |
6 | Input.shipping_rates.each do |shipping_rate|
7 | next unless shipping_rate.name == "UPS Three-Day Select"
8 | shipping_rate.change_name("3 Day", message: "Change name from Ground to Standard Shipping")
9 | end
10 |
11 | Input.shipping_rates.each do |shipping_rate|
12 | next unless shipping_rate.name == "UPS Second Day Air"
13 | shipping_rate.change_name("2 Day", message: "Change name from Ground to Standard Shipping")
14 | end
15 |
16 | Input.shipping_rates.each do |shipping_rate|
17 | next unless shipping_rate.name == "UPS Next Day Air"
18 | shipping_rate.change_name("Next Day", message: "Change name from Ground to Standard Shipping")
19 | end
20 |
21 | Output.shipping_rates = Input.shipping_rates
22 |
--------------------------------------------------------------------------------
/loop-through-linklist:
--------------------------------------------------------------------------------
1 |
2 | {% for link in linklists.filter-collection-sidebar.links %}
3 | -
4 | {{ link.title }}
5 |
6 | {% endfor %}
7 |
8 |
9 |
10 | {% comment %}
11 | change filter-collection-sidebar to your menu handle
12 | {% endcomment %}
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/section-custom-css/custom-schema.liquid:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {
11 | "type": "text",
12 | "id": "customClass",
13 | "default": "banner__custom--page-width",
14 | "label": "Custom | Css class",
15 | "info": "To Add custom class to change the current layout styles"
16 | }
17 |
--------------------------------------------------------------------------------