@extends('layouts.app') @section('title', 'Shopping Cart') @section('content')

Shopping Cart

@if(count($cart) > 0)
@foreach($cart as $id => $item)
{{ $item['name'] }}
{{ $item['name'] }}
@if(isset($item['options']['size']))Size: {{ $item['options']['size'] }}
@endif @if(isset($item['options']['framing']))Framing: {{ $item['options']['framing'] }}@endif
${{ number_format($item['price'] * $item['quantity'], 2) }}
@endforeach
Cart Summary

@php $subtotal = 0; foreach($cart as $item) { $subtotal += $item['price'] * $item['quantity']; } $discount = 0; if(session()->has('coupon')) { $coupon = \App\Models\Coupon::where('code', session('coupon'))->first(); if($coupon) { if($coupon->type == 'fixed') $discount = $coupon->value; else $discount = ($subtotal * $coupon->value) / 100; } } $shipping = 50; $total = $subtotal - $discount + $shipping; @endphp

Subtotal: ${{ number_format($subtotal, 2) }}

@if($discount > 0)

Discount: -${{ number_format($discount, 2) }}

@endif

Shipping: ${{ number_format($shipping, 2) }}

Total: ${{ number_format($total, 2) }}


Proceed to Checkout
@else

Your cart is empty. Continue shopping

@endif
@endsection @push('scripts') @endpush