@php use Botble\Base\Facades\BaseHelper; use Botble\Ecommerce\Facades\Cart; use Botble\Ecommerce\Facades\EcommerceHelper; use Botble\Ecommerce\Facades\OrderHelper; use Botble\Theme\Facades\Theme; Theme::layout('full-width'); Theme::set('pageTitle', __('Shopping cart')); Theme::set('hideBreadcrumb', true); $cartContent = Cart::instance('cart')->content(); $cartCount = Cart::instance('cart')->count(); $rawSubTotal = Cart::instance('cart')->rawSubTotal(); $rawTax = EcommerceHelper::isTaxEnabled() ? Cart::instance('cart')->rawTax() : 0; $rawTotal = Cart::instance('cart')->rawTotal(); $couponDiscount = $couponDiscountAmount ?? 0; $promotionDiscount = $promotionDiscountAmount ?? 0; $totalDiscount = $couponDiscount + $promotionDiscount; $grandTotal = max(0, $rawTotal - $totalDiscount); $appliedCoupon = session('applied_coupon_code'); @endphp {{-- Wrapper for AJAX replacement after qty/coupon/remove updates. `data.cart_content` from PublicCartController::getDataForResponse re-renders this whole blade — JS swaps this div with the new HTML so totals can never drift out of sync. --}}

{{ __('Shopping cart') }}

{{ __('Review your selected items, update quantities, and get ready for a smooth and easy checkout experience.') }}

@if ($cartCount === 0 || ! isset($products) || $products->isEmpty())

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

{{ __('Looks like you have not added anything to your cart yet.') }}

{{ __('Continue shopping') }}
@else
@if (session('success_msg')) @endif @if (session('error_msg')) @endif {{-- Update form: row hidden inputs (`items[][rowId]`) and the qty inputs from cart-quantity.blade.php (`name="items[][values][qty]"`) POST together to public.cart.update. The plugin also wires `data-bb-toggle="update-cart"` on each input for inline AJAX updates. --}}
@foreach ($cartContent as $key => $cartItem) @php($product = $products->find($cartItem->id)) @continue(empty($product)) @endforeach

{{ __('Product') }}

{{ __('Price') }}

{{ __('Quantity') }}

{{ __('Total') }}

{!! apply_filters('ecommerce_cart_before_item_content', null, $cartItem) !!} {{ RvMedia::image( $cartItem->options['image'] ?? $product->original_product->image, $product->original_product->name, 'thumb' ) }}
{{ $product->original_product->name }}
{!! BaseHelper::clean($product->stock_status_html) !!}
@if (is_plugin_active('marketplace') && $product->original_product->store?->id) @endif @if (! empty($cartItem->options['attributes']))
{{ $cartItem->options['attributes'] }}
@endif @if (EcommerceHelper::isEnabledProductOptions() && ! empty($cartItem->options['options'])) {!! render_product_options_html($cartItem->options['options'], $product->price()->getPrice()) !!} @endif @include( EcommerceHelper::viewPath('includes.cart-item-options-extras'), ['options' => $cartItem->options] ) {!! apply_filters('ecommerce_cart_after_item_content', null, $cartItem) !!}
@include(EcommerceHelper::viewPath('includes.product-price'), [ 'product' => $product, 'priceWrapperClassName' => 'd-flex flex-column gap-1', 'priceClassName' => 'fw-semibold text-primary', 'priceOriginalWrapperClassName' => '', 'priceOriginalClassName' => 'small cl-text-2 text-decoration-line-through', 'priceFormatted' => format_price($cartItem->price), ]) @include(Theme::getThemeNamespace('views.ecommerce.includes.cart-quantity'), [ 'product' => $product, 'cartItem' => $cartItem, 'key' => $key, ]) {{ format_price($cartItem->price * $cartItem->qty) }}
{{-- Coupon form — POSTs to public.coupon.apply. Pre-fills with the active coupon code so the user sees what's applied. --}}
{!! apply_filters('ecommerce_cart_sidebar_before_checkout', null, $products) !!}
@endif
{{-- Cross-sell suggestions. The plugin's `cross-sale-products.blade.php` requires `$parentProduct` (per-product cross-sells), which the cart page doesn't have — it gets a flat `$crossSellProducts` collection from PublicCartController::getDataForResponse instead. Render those directly using the theme's product-card dispatcher in a swiper. --}} @if ( $cartCount > 0 && EcommerceHelper::isEnabledCrossSaleProducts() && isset($crossSellProducts) && $crossSellProducts->isNotEmpty() ) @endif
{{-- /data-cart-page-area --}}