This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tbody class="line-items"> | |
{% for item in cart.items %} | |
<tr> | |
<td>{{ item.product.title }}</td> | |
<td>{{ item.quantity }}</td> | |
<td> | |
{{ item.line_price }} | |
{% if item.total_discount > 0 %} | |
<s>{{ item.original_line_price }}</s> | |
( {{ item.message }} ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tfoot class="summary"> | |
<tr> | |
<td colspan="2">Subtotal</td> | |
<td>{{ cart.original_total_price | money }}</td> | |
</tr> | |
<tr> | |
<td colspan="2">Discount Savings</td> | |
<td>{{ cart.total_discount | money }}</td> | |
</tr> | |
<tr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@percent = Decimal.new(40) / 100.0 | |
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
next if product.gift_card? | |
next unless product.tags.include?('hugesale') | |
line_discount = line_item.line_price * @percent | |
line_item.change_line_price(line_item.line_price - line_discount, message: "HUGESALE! 40% off this item!") | |
end | |
Output.cart = Input.cart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@percent = Decimal.new(20) / 100.0 | |
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
next if product.gift_card? | |
next unless product.vendor.include?('Nike') | |
line_discount = line_item.line_price * @percent | |
line_item.change_line_price(line_item.line_price - line_discount, message: "20% off all Nike products!") | |
end | |
Output.cart = Input.cart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button type="submit" name="add" id="AddToCart-{{ section.id }}" {% unless current_variant.available %}disabled="disabled"{% endunless %} class="btn product-form__cart-submit{% if product.options.size == 1 and product.variants[0].title == 'Default Title' %} product-form__cart-submit--small{% endif %} {% if product.handle contains 'free-gift' %}free_item{% endif %}"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
$('.add_to_cart').on('click', function(e){ | |
var variantId = VARIANTID GOES HERE; | |
jQuery.getJSON('/cart.js', function(data){ | |
var items = data.items; | |
console.log(items); | |
var currentVarId; | |
var quantity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
discounted_product = FREE GIFT ID | |
products_needed = [PRODUCT THAT NEEDS TO BE ADDED FOR FREE GIFT] | |
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
products_seen << product.id if products_needed.include?(product.id) | |
end | |
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
discounted_product = FREE GIFT PRODUCT.ID | |
products_needed = [NEEDED PRODUCT.ID] | |
products_seen = [] | |
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
products_seen << product.id if products_needed.include?(product.id) | |
end | |
Input.cart.line_items.each do |line_item| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
item = 0 | |
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
if product.product_type == "Underwear" | |
item+=line_item.quantity | |
elsif product.product_type == "Socks" | |
item+=line_item.quantity | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DISCOUNTS_BY_QUANTITY = { | |
100 => 20, | |
50 => 15, | |
25 => 10, | |
10 => 5, | |
} | |
Input.cart.line_items.each do |line_item| | |
next if line_item.variant.product.gift_card? |