@php $customer = auth('customer')->user(); $isWholesaleCustomer = $customer && $customer->customer_type == 1; if ($isWholesaleCustomer && $product->wholesale_price) { $basePrice = $product->wholesale_price; if (hasCustomerDiscount()) { $displayPrice = $basePrice + getCustomerDiscountAmount(); } else { $displayPrice = $basePrice; } $originalPrice = $product->price_with_taxes; } else { $displayPrice = getCustomerDiscountedPrice($product, 'front_sale_price_with_taxes'); $originalPrice = getCustomerDiscountedPrice($product, 'price_with_taxes'); } $hasDiscount = hasCustomerDiscount() || $isWholesaleCustomer; $discountAmount = getCustomerDiscountAmount(); @endphp {{--
@if ($hasDiscount) {{ format_price($displayPrice) }} @if ($product->front_sale_price !== $product->price) {{ format_price($originalPrice) }} {{ round((($product->price - $product->front_sale_price) / $product->price) * 100) }}% Off @endif @else @if ($product->front_sale_price === $product->price) {{ format_price($product->front_sale_price_with_taxes) }} @else {{ format_price($product->front_sale_price_with_taxes) }} {{ format_price($product->price_with_taxes) }} {{ round((($product->price - $product->front_sale_price) / $product->price) * 100) }}% Off @endif @endif
--}}
{{ format_price($displayPrice) }} @if (format_price($displayPrice) != format_price($originalPrice)) {{ format_price($originalPrice) }} {{ number_format((($originalPrice - $displayPrice) / $originalPrice) * 100, 2) }}% Off @else @endif