| @@ -45,8 +45,9 @@ | ||
| 45 | 45 | */ |
| 46 | 46 | public function add_pro_preview_fields( $settings_fields ) { |
| 47 | 47 | $pro_fields = array_merge( |
| 48 | 48 | $this->pro_core_fields(), |
| 49 | + $this->license_fields(), | |
| 49 | 50 | $this->grace_period_fields(), |
| 50 | 51 | $this->payment_failure_fields(), |
| 51 | 52 | $this->api_fields(), |
| 52 | 53 | $this->health_queue_fields(), |
| @@ -78,9 +79,9 @@ | ||
| 78 | 79 | private function pro_core_fields() { |
| 79 | 80 | return [ |
| 80 | 81 | [ |
| 81 | 82 | 'type' => 'select', |
| 82 | - 'group' => 'main', | |
| 83 | + 'group' => 'renewals', | |
| 83 | 84 | 'priority' => 7, |
| 84 | 85 | 'field_data' => [ |
| 85 | 86 | 'id' => 'subscrpt_renewal_price', |
| 86 | 87 | 'title' => __( 'Renewal Price', 'subscription' ), |
| @@ -93,9 +94,9 @@ | ||
| 93 | 94 | ], |
| 94 | 95 | ], |
| 95 | 96 | [ |
| 96 | 97 | 'type' => 'toggle', |
| 97 | - 'group' => 'main', | |
| 98 | + 'group' => 'renewals', | |
| 98 | 99 | 'priority' => 8, |
| 99 | 100 | 'field_data' => [ |
| 100 | 101 | 'id' => 'subscrpt_early_renew', |
| 101 | 102 | 'title' => __( 'Early Renewal', 'subscription' ), |
| @@ -108,8 +109,50 @@ | ||
| 108 | 109 | ]; |
| 109 | 110 | } |
| 110 | 111 | |
| 111 | 112 | /** |
| 113 | + * Module: License integrations (Integrations/LicenseManagerWoo.php). | |
| 114 | + * | |
| 115 | + * @return array | |
| 116 | + */ | |
| 117 | + private function license_fields() { | |
| 118 | + return [ | |
| 119 | + [ | |
| 120 | + 'type' => 'heading', | |
| 121 | + 'group' => 'license_settings', | |
| 122 | + 'priority' => 4, | |
| 123 | + 'field_data' => [ | |
| 124 | + 'title' => __( 'License Settings', 'subscription' ), | |
| 125 | + ], | |
| 126 | + ], | |
| 127 | + [ | |
| 128 | + 'type' => 'toggle', | |
| 129 | + 'group' => 'license_settings', | |
| 130 | + 'priority' => 1, | |
| 131 | + 'field_data' => [ | |
| 132 | + 'id' => 'subscrpt_regenerate_license_on_renewal', | |
| 133 | + 'title' => __( 'Regenerate License on Renewal', 'subscription' ), | |
| 134 | + 'description' => __( 'Enable this option if you want to invalidate the old key and issue a fresh license key whenever a subscription renews.', 'subscription' ), | |
| 135 | + 'value' => '1', | |
| 136 | + 'checked' => '1' === get_option( 'subscrpt_regenerate_license_on_renewal', '0' ), | |
| 137 | + ], | |
| 138 | + ], | |
| 139 | + [ | |
| 140 | + 'type' => 'toggle', | |
| 141 | + 'group' => 'license_settings', | |
| 142 | + 'priority' => 2, | |
| 143 | + 'field_data' => [ | |
| 144 | + 'id' => 'subscrpt_deactivate_old_license_on_renewal', | |
| 145 | + 'title' => __( 'Deactivate Previous License', 'subscription' ), | |
| 146 | + 'description' => __( 'When a fresh license key is issued on renewal, deactivate the previous key. Turn off to let the previous key keep working until it expires.', 'subscription' ), | |
| 147 | + 'value' => '1', | |
| 148 | + 'checked' => '1' === get_option( 'subscrpt_deactivate_old_license_on_renewal', '1' ), | |
| 149 | + ], | |
| 150 | + ], | |
| 151 | + ]; | |
| 152 | + } | |
| 153 | + | |
| 154 | + /** | |
| 112 | 155 | * Module: Grace Period (Admin/Settings.php). |
| 113 | 156 | * |
| 114 | 157 | * @return array |
| 115 | 158 | */ |
| @@ -117,9 +160,9 @@ | ||
| 117 | 160 | return [ |
| 118 | 161 | [ |
| 119 | 162 | 'type' => 'heading', |
| 120 | 163 | 'group' => 'grace_period', |
| 121 | - 'priority' => 3, | |
| 164 | + 'priority' => 5, | |
| 122 | 165 | 'field_data' => [ |
| 123 | 166 | 'title' => __( 'Grace Period Settings', 'subscription' ), |
| 124 | 167 | ], |
| 125 | 168 | ], |
| @@ -180,9 +223,9 @@ | ||
| 180 | 223 | return [ |
| 181 | 224 | [ |
| 182 | 225 | 'type' => 'heading', |
| 183 | 226 | 'group' => 'payment_failure', |
| 184 | - 'priority' => 4, | |
| 227 | + 'priority' => 6, | |
| 185 | 228 | 'field_data' => [ |
| 186 | 229 | 'title' => __( 'Payment Failure Handling', 'subscription' ), |
| 187 | 230 | ], |
| 188 | 231 | ], |
| @@ -316,9 +359,9 @@ | ||
| 316 | 359 | return [ |
| 317 | 360 | [ |
| 318 | 361 | 'type' => 'heading', |
| 319 | 362 | 'group' => 'health_queue', |
| 320 | - 'priority' => 8, | |
| 363 | + 'priority' => 9, | |
| 321 | 364 | 'field_data' => [ |
| 322 | 365 | 'title' => __( 'Subscription Health', 'subscription' ), |
| 323 | 366 | ], |
| 324 | 367 | ], |
| @@ -360,8 +403,21 @@ | ||
| 360 | 403 | 'value' => '1', |
| 361 | 404 | 'checked' => '1' === get_option( 'wp_subscription_auto_complete_order', '1' ), |
| 362 | 405 | ], |
| 363 | 406 | ], |
| 407 | + [ | |
| 408 | + 'type' => 'toggle', | |
| 409 | + 'group' => 'payment_gateways', | |
| 410 | + 'priority' => 2, | |
| 411 | + 'field_data' => [ | |
| 412 | + 'id' => 'subscrpt_require_payment_on_trial', | |
| 413 | + 'title' => __( 'Require Payment for Free Trials', 'subscription' ), | |
| 414 | + 'label' => __( 'Collect payment details at checkout for trial subscriptions', 'subscription' ), | |
| 415 | + 'description' => __( 'Collect payment details up front on free trials so renewals charge automatically.', 'subscription' ), | |
| 416 | + 'value' => '1', | |
| 417 | + 'checked' => '1' === get_option( 'subscrpt_require_payment_on_trial', '1' ), | |
| 418 | + ], | |
| 419 | + ], | |
| 364 | 420 | ]; |
| 365 | 421 | } |
| 366 | 422 | |
| 367 | 423 | /** |
| @@ -371,10 +427,18 @@ | ||
| 371 | 427 | */ |
| 372 | 428 | private function switch_fields() { |
| 373 | 429 | return [ |
| 374 | 430 | [ |
| 431 | + 'type' => 'heading', | |
| 432 | + 'group' => 'switching', | |
| 433 | + 'priority' => 3, | |
| 434 | + 'field_data' => [ | |
| 435 | + 'title' => __( 'Switching & Upgrades', 'subscription' ), | |
| 436 | + ], | |
| 437 | + ], | |
| 438 | + [ | |
| 375 | 439 | 'type' => 'toggle', |
| 376 | - 'group' => 'general', | |
| 440 | + 'group' => 'switching', | |
| 377 | 441 | 'priority' => 9, |
| 378 | 442 | 'field_data' => [ |
| 379 | 443 | 'id' => 'subscrpt_switch_enabled', |
| 380 | 444 | 'title' => __( 'Switch Subscription', 'subscription' ), |
| @@ -385,9 +449,9 @@ | ||
| 385 | 449 | ], |
| 386 | 450 | ], |
| 387 | 451 | [ |
| 388 | 452 | 'type' => 'toggle', |
| 389 | - 'group' => 'general', | |
| 453 | + 'group' => 'switching', | |
| 390 | 454 | 'priority' => 10, |
| 391 | 455 | 'field_data' => [ |
| 392 | 456 | 'id' => 'subscrpt_downgrade_allowed', |
| 393 | 457 | 'title' => __( 'Downgrade Subscription', 'subscription' ), |
| @@ -398,9 +462,9 @@ | ||
| 398 | 462 | ], |
| 399 | 463 | ], |
| 400 | 464 | [ |
| 401 | 465 | 'type' => 'join', |
| 402 | - 'group' => 'general', | |
| 466 | + 'group' => 'switching', | |
| 403 | 467 | 'priority' => 11, |
| 404 | 468 | 'field_data' => [ |
| 405 | 469 | 'title' => __( 'Switch Fee', 'subscription' ), |
| 406 | 470 | 'description' => __( 'Optional fee charged when a customer switches plans. Use a flat amount or a percentage of the new plan price. (0 = no fee)', 'subscription' ), |
| @@ -438,9 +502,9 @@ | ||
| 438 | 502 | ], |
| 439 | 503 | ], |
| 440 | 504 | [ |
| 441 | 505 | 'type' => 'select', |
| 442 | - 'group' => 'general', | |
| 506 | + 'group' => 'switching', | |
| 443 | 507 | 'priority' => 12, |
| 444 | 508 | 'field_data' => [ |
| 445 | 509 | 'id' => 'subscrpt_switch_fee_apply_to', |
| 446 | 510 | 'title' => __( 'Apply Fee To', 'subscription' ), |
| @@ -465,9 +529,9 @@ | ||
| 465 | 529 | return [ |
| 466 | 530 | [ |
| 467 | 531 | 'type' => 'heading', |
| 468 | 532 | 'group' => 'role_based_settings', |
| 469 | - 'priority' => 6, | |
| 533 | + 'priority' => 7, | |
| 470 | 534 | 'field_data' => [ |
| 471 | 535 | 'title' => __( 'Role-Based Settings', 'subscription' ), |
| 472 | 536 | ], |
| 473 | 537 | ], |
| @@ -495,9 +559,9 @@ | ||
| 495 | 559 | return [ |
| 496 | 560 | [ |
| 497 | 561 | 'type' => 'heading', |
| 498 | 562 | 'group' => 'live_qr_settings', |
| 499 | - 'priority' => 5, | |
| 563 | + 'priority' => 8, | |
| 500 | 564 | 'field_data' => [ |
| 501 | 565 | 'title' => __( 'Quick Details QR Settings', 'subscription' ), |
| 502 | 566 | ], |
| 503 | 567 | ], |
| @@ -568,9 +632,9 @@ | ||
| 568 | 632 | return [ |
| 569 | 633 | [ |
| 570 | 634 | 'type' => 'heading', |
| 571 | 635 | 'group' => 'payment_gateways', |
| 572 | - 'priority' => 0.1, | |
| 636 | + 'priority' => 1, | |
| 573 | 637 | 'field_data' => [ |
| 574 | 638 | 'title' => __( 'Payment Gateway Settings', 'subscription' ), |
| 575 | 639 | ], |
| 576 | 640 | ], |