Skip to content

Instantly share code, notes, and snippets.

@seedcms
seedcms / combined_script_1
Created February 4, 2017 05:42
Combined script 1
money = Money.zero
PAID_ITEM_COUNT = 1
DISCOUNTED_ITEM_COUNT = 1
def discounted_items_to_find(total_items_seen, discounted_items_seen)
Integer(total_items_seen / (PAID_ITEM_COUNT + DISCOUNTED_ITEM_COUNT) * DISCOUNTED_ITEM_COUNT) - discounted_items_seen
end
def partition(cart, line_items)
sorted_items = line_items.sort_by{|line_item| line_item.variant.price}.reverse
@seedcms
seedcms / checkout.liquid
Created February 4, 2017 05:43
Checkout Script
setTimeout(function(){
$(".total-line.total-line--reduction > .total-line__price").css("color", "#4b4b4b");
$(".total-line.total-line--reduction > .total-line__price").css("font-weight", "500");
$(".total-line.total-line--reduction > .total-line__price > .order-summary__emphasis").replaceWith("APPLIED");
},1000);
@seedcms
seedcms / coupon_over
Created February 4, 2017 05:45
Coupon "Over"
money = Money.zero
Input.cart.line_items.each do |line_item|
money+=line_item.line_price
end
Input.cart.line_items.each do |line_item|
puts money
cart = Input.cart
product = line_item.variant.product
@seedcms
seedcms / xyz_1
Created February 4, 2017 06:16
XYZ Script
money = Money.zero
Input.cart.line_items.each do |line_item|
cart = Input.cart
product = line_item.variant.product
money+=line_item.line_price
if cart.discount_code.code == "XYZ"
if product.tags.include?('shoes')
@seedcms
seedcms / product-swatches-dropdown.liquid
Created February 12, 2017 00:30
product-swatches-with-dropdown
<div class="product-swatches-{{product.id}}-2"></div>
<div class="product-swatches-{{product.id}}"></div>
<div style="clear:both;"></div>
<script>
jQuery(document).ready(function(){
$(document.body).on('change','.go-color',function(){
window.location = $(".go-color").val();
})
@seedcms
seedcms / RSQ.js
Created February 14, 2017 19:42
RS Script
var _rsq = _rsq || [];
_rsq.push([‘_setSiteId’, ‘415’]); Jouer's site ID is 415
_rsq.push([‘_enableOnsite’]);
var email = TBD Use something like document.getelement etc etc, to get the text value, you can call .toString on it to be make sure it is a string as well
_rsq.push([‘_setUserEmail’, email]); // Pass the variable for the email in
_rsq.push(['_setUserProperties', { 'record_id': email,'email': email,'registration_source':'footer'}]); Record_id and email are required for set user props to work, use email as the record_id since it won't be available for a new user.
@seedcms
seedcms / other-product-swatches-with-dropdown.liquid
Created February 18, 2017 19:54
product swatches with dropdown
<div class="product-swatches-{{product.id}}-2"></div>
<div class="product-swatches-{{product.id}}"></div>
<div style="clear:both;"></div>
<style>
.product-swatches-ul li {
border-color: #f7f7f7 !important;
max-width: 50px;
border-width: 3px;
}
</style>
@seedcms
seedcms / pressify-content-v1-external-link.liquid
Last active March 8, 2017 18:49
pressify-content-v1-external-link
@seedcms
seedcms / pressify-modal-v1-external-link.liquid
Last active March 8, 2017 18:49
pressify-modal-v1-external-link
@seedcms
seedcms / lookbooks-app.liquid
Last active December 5, 2017 18:08
lookbooks app snippet v3
{% if product.id %}
{% assign product_id = product.id %}
{% else %}
{% assign product_id = 0 %}
{% endif %}
{% if page.id %}
{% assign page_id = page.id %}
{% else %}
{% assign page_id = 0 %}