Files
slump-x-land-studio/templates/shop/cart.html
T

51 lines
2.0 KiB
HTML

{% extends 'base.html' %}
{% block title %}Cart · Shop · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell">
<h1>Shopping Cart</h1>
{% if items %}
<table style="width:100%;border-collapse:collapse;margin-bottom:1.5rem;">
<thead>
<tr><th align="left">Item</th><th align="left">Qty</th><th align="right">Total</th></tr>
</thead>
<tbody>
{% for row in items %}
<tr>
<td>{{ row.product.title }}</td>
<td>
<form method="post" action="{% url 'shop-cart-update' row.product.pk %}" style="display:inline-flex;gap:.4rem;">
{% csrf_token %}
<input type="number" name="quantity" value="{{ row.quantity }}" min="0" max="20" style="width:64px;">
<button type="submit">Update</button>
</form>
</td>
<td align="right">${{ row.line_total }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>Subtotal: <strong>${{ subtotal }}</strong></p>
{% if has_physical %}<p>Shipping: <strong>${{ shipping }}</strong></p>{% endif %}
<p style="font-size:1.25rem;">Total: <strong>${{ total }}</strong></p>
<form method="post" action="{% url 'shop-checkout' %}" style="margin-top:1.5rem;display:grid;gap:.75rem;max-width:380px;">
{% csrf_token %}
{% if not request.user.is_authenticated or not request.user.email %}
<label>Email (for receipt &amp; digital downloads)
<input type="email" name="email" required placeholder="you@example.com">
</label>
{% endif %}
{% if stripe_enabled %}
<button type="submit" name="gateway" value="stripe" class="btn">Checkout with Card / Apple Pay (Stripe)</button>
{% endif %}
{% if paypal_enabled %}
<button type="submit" name="gateway" value="paypal" class="btn">Checkout with PayPal</button>
{% endif %}
</form>
{% else %}
<p>Your cart is empty. <a href="{% url 'shop-index' %}">Browse the shop &rarr;</a></p>
{% endif %}
</main>
{% endblock %}