@extends('frontend.layouts.app', ['title' => $response['name']]) @section('content')
@php $isInWishlist = $wishlist->contains('product_id', $response['id']); @endphp

{{ $response['name'] }}

@php $mrp = $response['variations'][0]['mrp'] ?? $response['base_mrp']; $price = $response['variations'][0]['price'] ?? $response['base_price']; $percentOff = $mrp > 0 && $price > 0 ? round((($mrp - $price) / $mrp) * 100) : 0; @endphp
{{ $percentOff }}% off MRP₹{{ number_format($mrp, 0, '.', ',') }} ₹{{ $price }}
{{--

Price: ₹{{ $response['variations'][0]['price'] ?? 'N/A' }}

MRP: ₹{{ $response['variations'][0]['mrp'] ?? 'N/A' }}

--}}
@if (!empty($response['variation_attributes'])) @foreach ($response['variation_attributes'] as $attributeName => $attributeValues)
{{ $attributeName }}
@if ($attributeName === 'Color')
@foreach ($attributeValues as $index => $attribute) @endforeach
@else
@foreach ($attributeValues as $index => $attribute) @endforeach
@endif
@endforeach @endif

Description

{{ $response['description'] }}

@if ($related_products->isNotEmpty()) @endif @push('scripts') @endpush @endsection