144 lines
5.3 KiB
Plaintext
144 lines
5.3 KiB
Plaintext
{% liquid
|
||
assign free_shipping = section.settings.free_shipping | default: 699
|
||
assign threshold = free_shipping | times: 100
|
||
assign progress = 0
|
||
assign remaining = 0
|
||
assign unlocked = false
|
||
|
||
if threshold > 0
|
||
if cart.total_price >= threshold
|
||
assign progress = 100
|
||
assign unlocked = true
|
||
else
|
||
assign remaining = threshold | minus: cart.total_price
|
||
assign progress = cart.total_price | times: 100 | divided_by: threshold
|
||
endif
|
||
endif
|
||
%}
|
||
|
||
<section class="cart-page full-width">
|
||
<div class="cart-page__body">
|
||
<h1 class="cart-page__title">{{ 'cart.title' | t }}</h1>
|
||
|
||
{% if cart.item_count == 0 %}
|
||
<div class="cart-page__empty">
|
||
<p>{{ 'cart_drawer.empty' | t }}</p>
|
||
<a class="cart-page__checkout" href="{{ routes.all_products_collection_url }}">{{ 'cart.continue' | t }}</a>
|
||
</div>
|
||
{% else %}
|
||
<div class="cart-page__layout">
|
||
<div class="cart-page__items">
|
||
{% for item in cart.items %}
|
||
<article class="cart-page__line">
|
||
<a class="cart-page__thumb" href="{{ item.url }}">
|
||
{% if item.image %}
|
||
{{
|
||
item.image
|
||
| image_url: width: 240
|
||
| image_tag:
|
||
loading: 'lazy',
|
||
alt: item.product.title,
|
||
class: 'cart-page__img',
|
||
widths: '96, 160, 240',
|
||
sizes: '96px'
|
||
}}
|
||
{% endif %}
|
||
</a>
|
||
|
||
<div class="cart-page__copy">
|
||
<a class="cart-page__name" href="{{ item.url }}">{{ item.product.title | escape }}</a>
|
||
{% unless item.variant.title == 'Default Title' %}
|
||
<p class="cart-page__variant">{{ item.variant.title | escape }}</p>
|
||
{% endunless %}
|
||
<p class="cart-page__price">
|
||
{{ item.final_line_price | money_without_trailing_zeros }}
|
||
{% if item.original_line_price > item.final_line_price %}
|
||
<s>{{ item.original_line_price | money_without_trailing_zeros }}</s>
|
||
{% endif %}
|
||
</p>
|
||
<div class="cart-page__qty">
|
||
{% if item.quantity > 1 %}
|
||
<a
|
||
href="{{ routes.cart_change_url }}?line={{ forloop.index }}&quantity={{ item.quantity | minus: 1 }}"
|
||
aria-label="{{ 'cart_drawer.decrease' | t }}"
|
||
>−</a>
|
||
{% else %}
|
||
<span class="is-disabled" aria-hidden="true">−</span>
|
||
{% endif %}
|
||
<span>{{ item.quantity }}</span>
|
||
<a
|
||
href="{{ routes.cart_change_url }}?line={{ forloop.index }}&quantity={{ item.quantity | plus: 1 }}"
|
||
aria-label="{{ 'cart_drawer.increase' | t }}"
|
||
>+</a>
|
||
</div>
|
||
</div>
|
||
|
||
<a class="cart-page__remove" href="{{ item.url_to_remove }}" aria-label="{{ 'cart.remove' | t }}">
|
||
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
||
<path d="M2.5 4h11M6.5 4V2.5h3V4M4 4l.6 9.2a1 1 0 0 0 1 .8h4.8a1 1 0 0 0 1-.8L12 4" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
||
</svg>
|
||
</a>
|
||
</article>
|
||
{% endfor %}
|
||
</div>
|
||
|
||
<aside class="cart-page__summary">
|
||
{% if threshold > 0 %}
|
||
<div class="cart-page__shipping">
|
||
<p>
|
||
{% if unlocked %}
|
||
{{ 'cart_drawer.unlocked' | t }}
|
||
{% else %}
|
||
{{ 'cart_drawer.remaining_before' | t }}
|
||
{{ remaining | money_without_trailing_zeros }}
|
||
{{ 'cart_drawer.remaining_after' | t }}
|
||
<span>{{ 'cart_drawer.free' | t }}</span>
|
||
{% endif %}
|
||
</p>
|
||
<div
|
||
class="cart-page__bar"
|
||
style="--progress: {{ progress }}%;"
|
||
role="progressbar"
|
||
aria-valuemin="0"
|
||
aria-valuemax="100"
|
||
aria-valuenow="{{ progress }}"
|
||
aria-label="{{ 'cart_drawer.shipping_progress' | t }}"
|
||
>
|
||
<span class="cart-page__bar-fill"></span>
|
||
</div>
|
||
</div>
|
||
{% endif %}
|
||
|
||
<p class="cart-page__subtotal">
|
||
<span>{{ 'cart_drawer.subtotal' | t }}</span>
|
||
<strong>{{ cart.total_price | money_without_trailing_zeros }}</strong>
|
||
</p>
|
||
<p class="cart-page__note">{{ 'cart_drawer.taxes' | t }}</p>
|
||
|
||
<form action="{{ routes.cart_url }}" method="post">
|
||
<button class="cart-page__checkout" type="submit" name="checkout">{{ 'cart.checkout' | t }}</button>
|
||
</form>
|
||
<a class="cart-page__continue" href="{{ routes.all_products_collection_url }}">{{ 'cart.continue' | t }}</a>
|
||
</aside>
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
</section>
|
||
|
||
|
||
|
||
{% schema %}
|
||
{
|
||
"name": "t:general.cart",
|
||
"settings": [
|
||
{
|
||
"type": "number",
|
||
"id": "free_shipping",
|
||
"label": "t:cart_drawer.free_shipping",
|
||
"info": "t:cart_drawer.free_shipping_info",
|
||
"default": 699
|
||
}
|
||
]
|
||
}
|
||
{% endschema %}
|