@php /** @var \App\Models\WaProduct $product */ // Self-derive theme tokens — this partial renders in the child theme's // @section scope and does not inherit the base template's @php locals. $theme = $theme ?? []; $settings = $settings ?? []; $brand = $brand ?? ($theme['brand'] ?? ($settings['brand_color'] ?? '#075E54')); $bg = $bg ?? ($theme['bg'] ?? '#FBFAF6'); $surface = $surface ?? ($theme['surface'] ?? '#FFFFFF'); $border = $border ?? ($theme['border'] ?? '#E5DFD0'); $shopName = $shopName ?? ($workspace?->name ?: 'Store'); $onSale = $product->compare_price_minor && $product->compare_price_minor > $product->price_minor; $savings = $onSale ? $product->compare_price_minor - $product->price_minor : 0; $images = collect([$product->image_url]) ->concat(is_array($product->gallery_json) ? $product->gallery_json : []) ->filter() ->unique() ->values(); $sfFallback = ''; // body_html is stored verbatim (no sanitisation on save/import) and is // rendered raw below on this PUBLIC, same-origin checkout surface — an // unsanitised value is stored XSS. Allow-list sanitise it here at the // render sink so any script/on*/style/iframe payload is stripped while // legitimate rich text survives. require_once is idempotent. require_once app_path('Support/html_sanitize.php'); $bodyHtmlSafe = wadesk_sanitize_html($product->body_html); // ─────────────── Product variants (option combinations) ─────────────── // Additive: when the product has no variants this stays empty and the page // behaves exactly as before (single price + single Add-to-cart). $hasVariants = $product->hasVariants(); $variantList = []; $optionGroups = []; // option name => distinct values, in first-seen order if ($hasVariants) { foreach ($product->variants as $v) { $opts = is_array($v->options_json) ? $v->options_json : []; $normOpts = []; foreach ($opts as $name => $val) { $name = (string) $name; $val = (string) $val; $normOpts[$name] = $val; if (!isset($optionGroups[$name])) $optionGroups[$name] = []; if (!in_array($val, $optionGroups[$name], true)) $optionGroups[$name][] = $val; } $vp = $v->effectivePriceMinor(); $variantList[] = [ 'id' => (int) $v->id, 'options' => $normOpts, 'price' => $vp, 'price_display' => \App\Models\WaProduct::formatCurrency($vp, $product->currency_code), 'stock' => $v->availableQty(), 'label' => $v->label(), 'image' => $v->image_url, 'sku' => $v->sku, ]; } } $variantPrices = array_column($variantList, 'price'); $variantMinDisplay = $variantPrices ? \App\Models\WaProduct::formatCurrency(min($variantPrices), $product->currency_code) : $product->price_display; @endphp
{{ $product->description }}
@endif @if ($hasVariants)' . e($product->description ?: 'No description available yet — message the seller on WhatsApp to learn more.') . '
' !!}{{ __('Shipping.') }} Orders are dispatched within 1–2 business days. Delivery times depend on your location — typically 2–5 business days. Free shipping on orders above {{ $shipFreeText }}.
{{ __('Returns.') }} Unused items can be returned within 7 days of delivery. Message us on WhatsApp to start a return — we'll arrange the pickup.
{{ $rv->body }}
@endif{{ __('No reviews yet — be the first to review this product.') }}
@endif