@extends('front.layouts.master') @section('banner') @endsection @section('content')
@php $main_subtotal = 0; @endphp @foreach($cart as $item) @php $product_detail = \App\Models\Product::where('id',$item['product_id'])->first(); @endphp @csrf @php $subtotal = $item['quantity'] * $product_detail->price; @endphp @php $main_subtotal += $subtotal; @endphp @endforeach
Products Price Quantity SubTotal
{{ $item['name'] }} ${{ $product_detail->price }}
${{ number_format($subtotal, 2) }}
@csrf
Cart Totals
@php $final_amount = $main_subtotal; @endphp
Subtotal ${{ number_format($main_subtotal, 2) }}
Discount @if(session()->has('coupon')) @php $discount_amount = $main_subtotal * (session('coupon')['percentage'] / 100); $final_amount = $final_amount - $discount_amount; @endphp - ${{ number_format($discount_amount, 2) }} @else - $0.00 @endif
@if(session()->has('coupon'))
Applied Coupon: {{ session('coupon')['code'] }}
Remove
@endif
@csrf
Shipping
@foreach($shipping_methods as $shipping_method)
{{-- Check if this ID matches the ID stored in the session array --}} id ? 'checked' : '' }}>
@endforeach

Shipping Cost @php $shipping_cost = session('shipping_method')['cost'] ?? 0; $final_amount = $final_amount + $shipping_cost; @endphp + ${{ number_format($shipping_cost, 2) }}

Total ${{ number_format($final_amount, 2) }}
Proceed To Checkout
@endsection