🛒 Shop KDV Stratejisi v2 - FİNAL

📅 2025-12-03 | 🎯 Admin Her İki Fiyatı da Girer + Settings Gösterim | 🏢 iXtif

🎯 Ana Kural (v2 - FİNAL)

✅ Admin: Her İki Fiyatı da Girer

  • KDV Hariç Fiyat: 1.000 TL (price_without_tax)
  • KDV Dahil Fiyat: 1.200 TL (price_with_tax)
  • KDV Oranı: %20 (tax_rate)

⚙️ Yönetici: Settings'ten Gösterim Ayarı Yapar

Settings Management → Product Display Settings:

  • ☑️ KDV Dahil Fiyat Göster (with_tax) → Ürün kartlarında: "1.200 TL (KDV Dahil)"
  • ☑️ KDV Hariç Fiyat Göster (without_tax) → Ürün kartlarında: "1.000 TL + KDV"

Bu ayar tüm ürün kartlarına uygulanır (homepage, category, shop index).

🛒 Sepet + Checkout: HER ZAMAN KDV Dahil!

Ürün kartlarında ayar ne olursa olsun, sepet ve checkout sayfasında HER ZAMAN KDV dahil fiyat gösterilir.

🗄️ Database Migration

// shop_products tablosuna YENİ ALANLAR:

$table->decimal('price_without_tax', 12, 2)
->nullable()
->after('base_price')
->comment('KDV hariç fiyat');

$table->decimal('price_with_tax', 12, 2)
->nullable()
->after('price_without_tax')
->comment('KDV dahil fiyat');

⚙️ Settings Management

Setting Key: product_price_display
Type: select
Options:
- with_tax (KDV Dahil Göster)
- without_tax (KDV Hariç Göster)
Default: with_tax

Blade Kullanımı

@php
$display = setting('product_price_display', 'with_tax');
@endphp

@if($display === 'with_tax')
{{ number_format($product->price_with_tax, 2) }} TL (KDV Dahil)
@else
{{ number_format($product->price_without_tax, 2) }} TL + KDV
@endif

🛍️ CartService - Güncelleme

// Artık hesaplamaya gerek yok!
$priceWithoutTax = $item->price_without_tax ?? 0;
$priceWithTax = $item->price_with_tax ?? 0;
$taxRate = $item->tax_rate ?? 20.0;
$taxAmount = $priceWithTax - $priceWithoutTax;

$cartItem->unit_price = $priceWithoutTax;
$cartItem->tax_amount = $taxAmount;
$cartItem->final_price = $priceWithTax;
$cartItem->total = $priceWithTax * $quantity;

💳 Subscription - Aynı Mantık

billing_cycles: {
"monthly": {
"price_without_tax": 166.58,
"price_with_tax": 199.90,
"tax_rate": 20.00
}
}

✅ Özet