diff --git a/wp-ingame-shop/wp-ingame-shop-pro.php b/wp-ingame-shop/wp-ingame-shop-pro.php index bd3578a..4d3cf6b 100644 --- a/wp-ingame-shop/wp-ingame-shop-pro.php +++ b/wp-ingame-shop/wp-ingame-shop-pro.php @@ -374,6 +374,8 @@ class WIS_Activator { 'wis_daily_deal_enabled' => '0', 'wis_daily_deal_discount' => '20', 'wis_api_key' => bin2hex(random_bytes(24)), + 'wis_tax_enabled' => '0', + 'wis_tax_rate' => '0', ]; foreach ($defaults as $key => $value) { @@ -1230,6 +1232,8 @@ class WIS_Admin { update_option('wis_daily_deal_enabled', isset($_POST['wis_daily_deal_enabled']) ? '1' : '0'); update_option('wis_daily_deal_discount', intval($_POST['wis_daily_deal_discount'])); update_option('wis_offline_queue_enabled', isset($_POST['wis_offline_queue_enabled']) ? '1' : '0'); + update_option('wis_tax_enabled', isset($_POST['wis_tax_enabled']) ? '1' : '0'); + update_option('wis_tax_rate', max(0, min(100, floatval(str_replace(',', '.', $_POST['wis_tax_rate'] ?? '0'))))); echo '

✅ Einstellungen gespeichert!

'; } @@ -1357,6 +1361,24 @@ class WIS_Admin {

Erfordert Spigot-Plugin v6.3+ mit Offline-Queue-Unterstützung

+ + Steuer aktivieren + + + + + + + + +

Z.B. 19 für 19 % MwSt. Nur aktiv wenn „Steuer aktivieren" angehakt ist.

+ +

@@ -3555,6 +3577,16 @@ class WIS_API { $final_price = max(0, $total_normal - $coupon_discount) + $total_offer; + // ── Steuer ────────────────────────────────────────────────── + $tax_enabled = get_option('wis_tax_enabled', '0'); + $tax_rate = floatval(get_option('wis_tax_rate', '0')); + $tax_amount = 0; + if ($tax_enabled === '1' && $tax_rate > 0) { + $tax_amount = floor($final_price * $tax_rate / 100); + $final_price = $final_price + $tax_amount; + } + // ──────────────────────────────────────────────────────────── + // Fly-Dauern (item_id → Sekunden) // Fly-Dauern und lesbares Label (wird dem Spieler auf dem Code angezeigt) $fly_durations = [ @@ -3936,6 +3968,17 @@ class WIS_Shortcode {

+ +
Gesamt: 0 @@ -3964,6 +4007,8 @@ class WIS_Shortcode { (function() { const shopCurrency = ; const shopExcludeOffers = ; + const shopTaxEnabled = ; + const shopTaxRate = ; const apiBase = ; const serverList = $s->slug,'name'=>$s->name]; }, $servers)); ?>; @@ -4268,7 +4313,7 @@ class WIS_Shortcode { document.getElementById('cart-modal').style.display = 'none'; } - function calculateTotal() { + function calculateSubtotal() { var normal = 0, offer = 0; cart.forEach(function(item) { var t = item.price * item.quantity; @@ -4283,6 +4328,16 @@ class WIS_Shortcode { return Math.max(0, normal - discount) + offer; } + function calculateTax(subtotal) { + if (!shopTaxEnabled || shopTaxRate <= 0) return 0; + return Math.floor(subtotal * shopTaxRate / 100); + } + + function calculateTotal() { + var subtotal = calculateSubtotal(); + return subtotal + calculateTax(subtotal); + } + function renderCart() { var content = document.getElementById('cart-content'); var checkout = document.getElementById('cart-checkout'); @@ -4312,6 +4367,19 @@ class WIS_Shortcode { }); document.getElementById('cart-total').textContent = calculateTotal() + ' ' + shopCurrency; + + // Steuer-Aufschlüsselung + var taxBreakdown = document.getElementById('wis-tax-breakdown'); + if (shopTaxEnabled && shopTaxRate > 0 && taxBreakdown) { + var sub = calculateSubtotal(); + var tax = calculateTax(sub); + document.getElementById('cart-subtotal').textContent = sub + ' ' + shopCurrency; + document.getElementById('cart-tax').textContent = tax + ' ' + shopCurrency; + taxBreakdown.style.display = 'block'; + } else if (taxBreakdown) { + taxBreakdown.style.display = 'none'; + } + checkout.style.display = 'block'; }