Initial commit
This commit is contained in:
61
skrift-configurator/create-test-voucher.php
Normal file
61
skrift-configurator/create-test-voucher.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* EINMALIG AUSFÜHREN: Test-Gutschein erstellen
|
||||
*
|
||||
* Anleitung:
|
||||
* 1. Diese Datei in den Plugin-Ordner legen
|
||||
* 2. Im Browser aufrufen: https://ihre-domain.de/wp-content/plugins/skrift-konfigurator/create-test-voucher.php
|
||||
* 3. Nach erfolgreicher Ausführung diese Datei LÖSCHEN
|
||||
*/
|
||||
|
||||
// WordPress laden
|
||||
require_once('../../../wp-load.php');
|
||||
|
||||
// Sicherheit: Nur für Admins
|
||||
if (!current_user_can('manage_options')) {
|
||||
die('Keine Berechtigung');
|
||||
}
|
||||
|
||||
// Test-Gutscheine erstellen
|
||||
$vouchers = get_option('skrift_konfigurator_vouchers', []);
|
||||
|
||||
// Test-Gutschein 1: 10% Rabatt
|
||||
$vouchers['TEST10'] = [
|
||||
'code' => 'TEST10',
|
||||
'type' => 'percent',
|
||||
'value' => 10,
|
||||
'expiry_date' => '', // Unbegrenzt
|
||||
'usage_limit' => 0, // Unbegrenzt
|
||||
'usage_count' => 0,
|
||||
];
|
||||
|
||||
// Test-Gutschein 2: 5€ Rabatt
|
||||
$vouchers['SAVE5'] = [
|
||||
'code' => 'SAVE5',
|
||||
'type' => 'fixed',
|
||||
'value' => 5.00,
|
||||
'expiry_date' => '', // Unbegrenzt
|
||||
'usage_limit' => 0, // Unbegrenzt
|
||||
'usage_count' => 0,
|
||||
];
|
||||
|
||||
// Test-Gutschein 3: 20% Rabatt mit Limit
|
||||
$vouchers['WELCOME20'] = [
|
||||
'code' => 'WELCOME20',
|
||||
'type' => 'percent',
|
||||
'value' => 20,
|
||||
'expiry_date' => date('Y-m-d', strtotime('+30 days')), // 30 Tage gültig
|
||||
'usage_limit' => 10, // Max 10x einlösbar
|
||||
'usage_count' => 0,
|
||||
];
|
||||
|
||||
update_option('skrift_konfigurator_vouchers', $vouchers);
|
||||
|
||||
echo '<h1>✓ Test-Gutscheine erfolgreich erstellt!</h1>';
|
||||
echo '<ul>';
|
||||
echo '<li><strong>TEST10</strong> - 10% Rabatt (unbegrenzt)</li>';
|
||||
echo '<li><strong>SAVE5</strong> - 5,00€ Rabatt (unbegrenzt)</li>';
|
||||
echo '<li><strong>WELCOME20</strong> - 20% Rabatt (30 Tage gültig, max. 10x)</li>';
|
||||
echo '</ul>';
|
||||
echo '<p><a href="' . admin_url('options-general.php?page=skrift-vouchers') . '">→ Gutscheine im Backend anzeigen</a></p>';
|
||||
echo '<p style="color: red;"><strong>WICHTIG: Bitte löschen Sie diese Datei jetzt aus Sicherheitsgründen!</strong></p>';
|
||||
Reference in New Issue
Block a user