@php use Botble\Ecommerce\Facades\Cart; use Botble\Ecommerce\Facades\EcommerceHelper; use Botble\Media\Facades\RvMedia; use Illuminate\Support\Arr; $cartContent = $cartContent ?? Cart::instance('cart')->content(); $cartUpdateUrl = route('public.cart.update'); // Load product models in one batch so we can render sale + original price // (mirrors shofy/partials/mini-cart/content.blade.php). $cartProducts = Cart::instance('cart')->products(); @endphp @if ($cartContent->isEmpty()) {{-- Empty state — script.js (D::s) hides this when sibling .tf-mini-cart-item children exist. --}}

{{ __('Your cart is empty') }}

{{ __('Your cart is currently empty. Let us assist you in finding the right product.') }}

{{ __('Shopping') }} {{ __('Back to home') }}
@endif @foreach ($cartContent as $cartItem) @php $product = $cartProducts->find($cartItem->id); $productImage = Arr::get($cartItem->options, 'image'); $productUrl = $product?->original_product?->url ?: Arr::get($cartItem->options, 'url', '#'); $optionAttrs = Arr::get($cartItem->options, 'attributes'); @endphp {{-- NOT using `.file-delete` — that class triggers main.js mock-delete handler. The X button below uses the plugin's `data-bb-toggle="remove-from-cart"` for a real AJAX remove, then `ecommerce.cart.removed` cleans the row. --}}
{{ $cartItem->name }}
{{ $cartItem->name }} {{-- Inline quantity widget — POSTs to public.cart.update on change. Self-contained handlers in main.js (look for "mini-cart-qty"). --}}
@if ($product) @include(EcommerceHelper::viewPath('includes.product-price'), [ 'product' => $product, 'priceWrapperClassName' => 'd-flex align-items-baseline gap-2', 'priceClassName' => 'price-new fw-semibold text-primary', 'priceOriginalWrapperClassName' => '', 'priceOriginalClassName' => 'price-old text-caption-01 cl-text-2 text-decoration-line-through', 'priceFormatted' => format_price($cartItem->price * $cartItem->qty), ]) @else {{ format_price($cartItem->price * $cartItem->qty) }} @endif
@if (! empty($optionAttrs))
{{ $optionAttrs }}
@endif
{{-- Close (X) — replaces the previous "Remove" link. Uses the plugin's standard data-bb-toggle so the AJAX remove fires; ecommerce.cart.removed listener (main.js) then removes this row visually. --}}
@endforeach