@extends('front.include.app') @section('content')
@if (session()->has('shipping_rates') && count(session('shipping_rates')) > 0)

Available Shipping Rates

@foreach (session('shipping_rates') as $index => $rate) @endforeach @else
No shipping rates available.
@endif @php $cart = session()->get('cart', []); $cartTotal = 0; $grandTotal = 0; $shippingTotal = 0; foreach ($cart as $item) { $cartTotal += $item['price'] * $item['quantity']; } if ($cartTotal < 100) { $grandTotal = $cartTotal + $shippingTotal; session(['grand_total' => $grandTotal]); $shippingTotal = session('selected_shipping_cost', 0); } else { $grandTotal = $cartTotal; session(['grand_total' => $grandTotal]); } $shippingCharge = $shippingTotal; $finalAmount = session('total_after_discount') ? session('total_after_discount') + $shippingCharge : $cartTotal + $shippingCharge; @endphp

Order Summary

Subtotal ({{ count($cart) }})
@if(session('total_after_discount')) CAD ${{ session('total_after_discount') }} @else CAD ${{ number_format($cartTotal, 2) }} @endif
Shipping
{{ isset($shippingTotal) && $shippingTotal != 0 ? 'CAD $' . number_format($shippingTotal, 2) : 'Free Shipping' }}
Total
CAD ${{ number_format($finalAmount, 2) }}
@csrf
@php $countryCode = session('countryCode'); $orders = \App\Models\Order::all(); $orderCount = $orders->count(); @endphp @endsection @section('script') @endsection