{# Mini Cart Components ==================== Cart preview dropdown and cart item components. Usage: {% from 'shared/macros/storefront/mini-cart.html' import mini_cart, cart_icon_button, cart_item %} #} {# Cart Icon Button ================ Cart icon with item count badge for header. Parameters: - cart_count_var: Alpine.js expression for cart item count (default: 'cart.items.length') - toggle_action: Alpine.js action to toggle cart dropdown (default: 'toggleCart()') - size: 'sm' | 'md' | 'lg' (default: 'md') Usage: {{ cart_icon_button() }} #} {% macro cart_icon_button( cart_count_var='cart.items.length', toggle_action='toggleCart()', size='md' ) %} {% set sizes = { 'sm': {'btn': 'p-1.5', 'icon': 'w-5 h-5', 'badge': 'w-4 h-4 text-xs -top-1 -right-1'}, 'md': {'btn': 'p-2', 'icon': 'w-6 h-6', 'badge': 'w-5 h-5 text-xs -top-1.5 -right-1.5'}, 'lg': {'btn': 'p-2.5', 'icon': 'w-7 h-7', 'badge': 'w-6 h-6 text-sm -top-2 -right-2'} } %} {% set s = sizes[size] %} {% endmacro %} {# Mini Cart Dropdown ================== Cart preview dropdown showing recent items. Parameters: - cart_var: Alpine.js variable for cart object (default: 'cart') - show_var: Alpine.js variable for dropdown visibility (default: 'showCart') - max_items: Maximum items to show (default: 3) - cart_url: URL to full cart page (default: '/cart') - checkout_url: URL to checkout (default: '/checkout') Expected cart object structure: { items: [ {id, product_id, name, image_url, price, quantity, variant_name} ], subtotal: number, item_count: number } Usage: {{ mini_cart() }} #} {% macro mini_cart( cart_var='cart', show_var='showCart', max_items=3, cart_url='/cart', checkout_url='/checkout' ) %}
{# Header #}

Shopping Cart

{# Empty State #}

Your cart is empty

Continue Shopping
{# Cart Items #}
{# More Items Notice #}
{# Footer #}
{# Subtotal #}
Subtotal
{# Actions #}
{% endmacro %} {# Cart Item (Mini version) ======================== Compact cart item for mini cart dropdown. Parameters: - cart_var: Cart variable for remove action (default: 'cart') Usage: #} {% macro cart_item_mini(cart_var='cart') %}
{# Image #} {# Details #}

{# Remove Button #}
{% endmacro %} {# Cart Item (Full version) ======================== Full cart item for cart page with quantity controls. Parameters: - item_var: Variable name for item (default: 'item') - index_var: Variable name for index (default: 'index') - show_image: Show product image (default: true) - editable: Allow quantity editing (default: true) Usage: #} {% macro cart_item( item_var='item', index_var='index', show_image=true, editable=true ) %} {% from 'shared/macros/inputs.html' import number_stepper %}
{# Image #} {% if show_image %} {% endif %} {# Details #}

{# Remove Button #}
{# Quantity and Total #}
{% if editable %}
{{ number_stepper( model=item_var ~ '.quantity', min=1, max=item_var ~ '.max_quantity', size='sm', label='Quantity' ) }}
{% else %} {% endif %}
{# Low Stock Warning #}
{% endmacro %} {# Cart Summary ============ Order summary with totals and checkout button. Parameters: - cart_var: Alpine.js variable for cart (default: 'cart') - show_promo: Show promo code input (default: true) - show_shipping: Show shipping estimate (default: true) - checkout_url: Checkout URL (default: '/checkout') Expected cart structure: { subtotal: number, discount: number, shipping: number, tax: number, total: number, promo_code: string | null } Usage: {{ cart_summary() }} #} {% macro cart_summary( cart_var='cart', show_promo=true, show_shipping=true, checkout_url='/checkout' ) %}

Order Summary

{# Promo Code #} {% if show_promo %}

{% endif %} {# Totals #}
Subtotal
Discount
{% if show_shipping %}
Shipping
{% endif %}
Tax
Total
{# Checkout Button #}
Proceed to Checkout {# Trust Badges #}
Secure Checkout SSL Encrypted
{% endmacro %}