Skip to content

Instantly share code, notes, and snippets.

@svaustin66
svaustin66 / Klaviyo-Coupon.txt
Last active October 27, 2018 20:11
Klaviyo Code to Add Discount Code and Take Customer to Cart
https://storedomain.com/discount/{% coupon_code 'Klaviyo_Coupon_Code' %}?redirect=/cart
@svaustin66
svaustin66 / Klaviyo-Checkout.txt
Created October 27, 2018 20:18
Send the Customer Straight to Checkout in Klaviyo
{{ event.extra.checkout_url }}
<!-- Start Cart Size Discount Section -->
{% if settings.cart_size_enable %}
{% assign cartamount = cart.total_price %}
{% assign threshold = settings.sleepwear_threshold | times:100 %}
{% assign cart-remaining = threshold %}
{% assign cart-remaining = cart-remaining | minus:cartamount %}
{% if cartamount < threshold %}
/*--- Cart Messages ---*/
#cart-message {
background-color: {{ settings.cart_promo_background }};
padding: 15px;
}
.cart-upsell {
padding: 20px;
text-align: center;
{
"name": "Cart Promotions",
"settings": [
{
"type": "header",
"content": "Rush Processing"
},
{
"type": "checkbox",
"id": "cart_rush_enable",
@svaustin66
svaustin66 / cart-template.liquid
Created November 21, 2019 22:43
Exclude Line Item Property from Displaying
{% for p in item.properties %}
{% unless p.last == blank %}
{% unless p.first contains '_snapshotId' %}
{% if p.last contains '/uploads/' %}
<div>
{{ p.first }}: <a class="lightbox" href="{{ p.last }}">{{ 'cart.general.uploaded_file' | t }}</a>
</div>
{% else %}
<div class="property-{{ p.first }}">
{{ p.first }}: {{ p.last }}
@svaustin66
svaustin66 / cart-clean.liquid
Created November 21, 2019 22:49
JavaScript to clean up line item properties
<script>
document.addEventListener('DOMContentLoaded', function() {
var divArt = document.getElementsByClassName('property-Art');
var text = divArt.innerText;
for (var i = 0; i < divArt.length; i++) {
var text = divArt[i].innerText;
text = text.replace(/\s*\(.*?\)\s*/g, '');
divArt[i].innerText = text;
};
}, false);
@svaustin66
svaustin66 / theme.liquid
Created November 21, 2019 22:54
Load the JavaScript onto the Cart Page
{% if template contains 'cart'%}
{% include 'cart-clean' %}
{% endif %}
@svaustin66
svaustin66 / cart-template.liquid
Created November 21, 2019 22:59
Add a class that is easy to find to the DIV
<div class="property-{{ p.first }}">
{{ p.first }}: {{ p.last }}
</div>
@svaustin66
svaustin66 / page.admin.liquid
Created November 27, 2019 02:00
Only allow page access to Admins
{% if customer %}
{% if customer.tags contains 'admin' %}
<a name="pagecontent" id="pagecontent"></a>
<div class="sixteen columns page clearfix">
<h1>
{{ page.title }}
</h1>
<div class="feature_divider"></div>
<div>
{% include 'page-multi-column', content: page.content %}