Skip to content

Instantly share code, notes, and snippets.

@ECkurt
ECkurt / Sticky Menu CSS
Last active August 29, 2015 13:56
Crazy Responsive Sticky Menu
body {
font-size: 16px;
line-height: 1.4;
margin: 0;
font-family: Georgia, Times, "Times New Roman", serif;
background-color: #EEE;
}
.clearfix:before,.clearfix:after {content: " "; display: table;}
.clearfix:after {clear: both;}
@ECkurt
ECkurt / gist:d6da6a6936817e3b3f8b7e40dd0d4f21
Created June 17, 2016 15:11
Shopify Collection Tags Duplicate Content Fix
{% if template contains 'collection' and current_tags %}
<meta name="robots" content="noindex" />
<link rel="canonical" href="{{ collection.url }}" />
{% else %}
<link rel="canonical" href="{{ canonical_url }}" />
{% endif %}
@ECkurt
ECkurt / gist:bf14bb4233bfbbdd24d44e7b7399c62b
Created June 17, 2016 18:08
Shopify 404 URL redirect
{% if template == '404' %}
<meta http-equiv="refresh" content="0;URL=http://example.com/collections/404/" />
{% endif %}
@ECkurt
ECkurt / Order Confirmation
Last active March 13, 2017 23:37
Subject: A warm thank you for order {{name}}
{% capture email_title %}Thank you for your purchase {% endcapture %}
{% capture email_body %}
<p>Hi {{ customer.first_name }}</p>
<p>A great big thank you for shopping with {{ shop_name }}</p>
<p>We value your opinion, and we'd love to hear your feedback</p>
<p>If you have 47 seconds to answer two quick questions, we'd be very grateful if you could <b>hit reply &amp; tell us:</b></p>
<ol style="color:#777777;">
<li>What type of person do you think would benefit most from {{ shop.name }}?</li>
<li>Why would you recommend {{ shop.name }}? In other words, what benefit would someone get from {{ shop.name }}?</li>
</ol>
@ECkurt
ECkurt / abandoned cart recovery notification
Last active December 13, 2017 19:47
Subject: do you need any help with your order?
{% if billing_address.first_name %}Hi {{ billing_address.first_name }},
{% elsif shipping_address.first_name %}Hi {{ shipping_address.first_name }},{% endif %}
<p>Friendly check-in from {{ shop.name }}.</p>
<p>I saw you put together a shopping cart on our site but didn’t finish your order.</p>
<p>Did you need any help? Or did you have any questions about the order I can answer before you submit it?</p>
<p>If there’s anything I can do, just hit the reply button and drop me a line with any product or order questions.</p>
<p>{{ custom_message }}</p>
<p>I’ve included a list of your shopping cart contents below. You can click this link to load up the shopping cart again.</p>
<p><b><a href="{{ url }}">Your cart:</a></b></p>
<table class="row">
{% if cart.total_price < 5000 %}
<p>You're <span>{{ 5000 | minus: cart.total_price | money }}</span> away from receiving free shipping on your order!</p>
{% else %}
<p><b>FREE SHIPPING</b></p>
{% endif %}
discount_message = ""
discount = 0.999999999999 # It won't actually work with only 1 item in cart unless it calculates a different total, discount * 1 will simply not do anything
total_items = 0
Input.cart.line_items.each do |line_item|
total_items += line_item.quantity
end
case total_items
when 0
discount_message = "Add something to your cart!"
DISCOUNT_PERCENT=30
CART_DISCOUNT_MESSAGE="Buy 2 or more items and get 30% off the least expensive item"
eligible_items = Input.cart.line_items.select do |line_item|
product = line_item.variant.product
!product.gift_card?
end
# Sort eligible items by price, least exensive first
discount_product_ids = [10593412163,301378967] # Enter qualifying product_id
free_product_id = 359354662944
valid_product = false
Input.cart.line_items.each do |line_item|
product = line_item.variant.product
valid_product = true if (discount_product_ids.include?(product.id) or valid_product)
end
if valid_product
FREEBIE_PRODUCT_ID = 6621649541
CART_TOTAL_FOR_DISCOUNT_APPLIED = Money.new(cents: 100) * 100
DISCOUNT_MESSAGE = "Get a FREE gift for ordering $100 or more"
freebie_in_cart = false
cart_price_exceeds_discounted_freebie_amount = false
cost_of_freebie = Money.zero
# Test if the freebie is in the cart, also get its cost if it is so we can deduct from the cart total
Input.cart.line_items.select do |line_item|