@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.') }}
@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 }}
{{-- Inline quantity widget — POSTs to public.cart.update on change.
Self-contained handlers in main.js (look for "mini-cart-qty"). --}}
{{-- 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. --}}