@props(['product']) @if ($product) @php $oldPrice = (float) ($product->old_price ?? 0); $newPrice = (float) ($product->new_price ?? 0); $discount = $oldPrice > 0 ? round((($oldPrice - $newPrice) / $oldPrice) * 100) : 0; $firstImg = $product->images->first()->image ?? 'placeholder.jpg'; $favouriteIds = $favouriteIds ?? []; // Ensure variable exists @endphp
৳{{ number_format($newPrice) }}
@if ($discount > 0) ৳{{ number_format($oldPrice) }} @endif