Skip to content

Instantly share code, notes, and snippets.

@joeainsworth
Created September 7, 2018 20:14
Show Gist options
  • Save joeainsworth/187c875820c8baf1595c39fea95e6063 to your computer and use it in GitHub Desktop.
Save joeainsworth/187c875820c8baf1595c39fea95e6063 to your computer and use it in GitHub Desktop.
cart.liquid
<div data-section-type="cart-template">
<div class="page-header">
<h1 class="majortitle">{{ 'cart.general.title' | t }}</h1>
</div>
{% if cart.items == empty %}
<div class="row-spacing align-centre">
<p>{{ 'cart.general.empty' | t }}</p>
</div>
{% else %}
<form action="/cart" method="post" id="cartform">
<ul class="item-list divider">
{% for item in cart.items %}
<li class="item cf {{ item.product.handle }}">
<a class="remove toggler" onclick="return confirm('{{ 'cart.general.confirm_remove' | t }}')" href="/cart/change?line={{ forloop.index }}&quantity=0">&#215;</a>
<div class="image">
<a href="{{ item.url }}"><img src="{{ item | img_url: 'small' }}" alt="{{ item.title | escape }}" /></a>
</div>
<div class="desc">
<div>
<a class="name" href="{{ item.url }}">{{ item.product.title }}
<span class='booster-cart-item-success-notes' data-key='{{item.key}}'></span><span class='booster-cart-item-upsell-notes' data-key='{{item.key}}'></span>
<span class="saso-cart-item-discount-notes" data-key="{{item.key}}"></span>
<span class="saso-cart-item-upsell-notes" data-key="{{item.key}}"></span>
</a>
{% if item.product.variants.size > 1 %}
<span class="variant">{{ item.variant.title }}</span>
{% endif %}
{% if item.variant.inventory_management == 'shopify' and item.variant.inventory_quantity < 1 %}
<div class="backorder">
<p>{{ 'cart.general.backorder' | t }}</p>
</div>
{% endif %}
</div>
{% for p in item.properties %}
{% unless p.last == blank %}
<span class="custom">
{% if forloop.index == 1 %}
{{ p.first | replace: '_', '' }}:
{% else %}
{{ p.first | replace: '_', '<br>' }}:
{% endif %}
{% if p.last contains '/uploads/' %}
<a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
{% else %}
{{ p.last }}
{% endif %}
</span>
{% endunless %}
{% endfor %}
</div>
<div class="quantotal">
<div class="quantity quantity-selector">
{%- assign quantity_minus_one = item.quantity | minus: 1 -%}
<a class="link" title="{{ 'cart.general.set_quantity' | t: new_quantity: quantity_minus_one }}" href="/cart/change?quantity={{ quantity_minus_one }}&line={{ forloop.index }}">
{%- include 'icon-minus' -%}
</a>
<span class="quantity-selector__current-quantity">{{ item.quantity }}</span>
{%- assign quantity_plus_one = item.quantity | plus: 1 -%}
<a class="link" title="{{ 'cart.general.set_quantity' | t: new_quantity: quantity_plus_one }}" href="/cart/change?quantity={{ quantity_plus_one }}&line={{ forloop.index }}">
{%- include 'icon-plus' -%}
</a>
</div>
<div class="line-total">
<span class="saso-cart-item-line-price" data-key="{{item.key}}"><span class='booster-cart-item-line-price' data-key='{{item.key}}'>{{ item.line_price | money }}</span></span>
<br>
{% for discount in item.discounts %}
-{{ discount.amount | money }}<br>
{% endfor %}
</div>
</div>
</li><!-- /.item -->
{% endfor %}
</ul>
<div class="divider cf">
{% if section.settings.enable_cart_notes %}
<div class="checkout-note layout-column-half-left">
<label for="note">{{ 'cart.label.note' | t }}</label>
<div class="textareawrapper"><textarea id="note" name="note">{{ cart.note }}</textarea></div>
</div><!-- /.checkout-note -->
{% endif %}
<div class="totals-area layout-column-half-right">
<div class="checkout-col">
<h2 class="subtotal h1-style"><span id="">
<span class=""><span id="bk-cart-subtotal-price"><span class="wh-original-cart-total"><span class="wh-original-price">{{ cart.total_price | money }}</span></span><span class="wh-cart-total"></span><div class="additional-notes"><span class="wh-minimums-note"></span><span class="wh-extra-note "></span></div></span></span>
<span class=""></span>
</span></h2>
{% if section.settings.cart_terms_page != blank %}
<div class="termsagreement">
<input type="checkbox" id="terms" />
{% assign terms_url = pages[section.settings.cart_terms_page].url %}
<label for="terms">{{ 'cart.terms.agreement_html' | t: terms_url: terms_url }}</label>
</div>
{% endif %}
<div class="checkout-buttons">
<input type="submit" class="notabutton" name="update" value="{{ 'cart.general.update' | t }}" /> {{ 'cart.general.or' | t }}
<input type="submit" class="altaltcolour" id="update-cart" name="checkout" value="{{ 'cart.general.checkout' | t }}" />
{% if additional_checkout_buttons %}
<div class="additional-checkout-buttons">
{{ content_for_additional_checkout_buttons }}
</div>
{% endif %}
</div>
<div>{{ 'cart.general.message' | t }}</div>
</div>
</div>
</div>
<div class="clearfix"></div>
{% include 'cross-sell-custom' %}
{% if section.settings.show_shipping_calculator %}
{% include 'shipping-calculator', default_country: section.settings.shipping_calculator_default_country %}
{% endif %}
</form>
{% endif %}
</div>
{% schema %}
{
"name": "Cart page",
"settings": [
{
"type": "checkbox",
"id": "enable_cart_notes",
"label": "Enable cart notes",
"default": false
},
{
"type": "page",
"id": "cart_terms_page",
"label": "Page for Terms and Conditions link"
},
{
"type": "header",
"content": "Shipping rates calculator"
},
{
"type": "checkbox",
"id": "show_shipping_calculator",
"label": "Show",
"default": false
},
{
"type": "text",
"id": "shipping_calculator_default_country",
"label": "Default country selection",
"default": "United States"
},
{
"type": "paragraph",
"content": "If your customer is logged-in, the country in his default shipping address will be selected. If you are not sure about the spelling to use here, refer to your first checkout page dropdown."
}
]
}
{% endschema %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment