PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.3.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.3.0
2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 All 65 releases
← All changes | includes/Admin/ProSettingsFields.php +128 -33 1.10.9 → 2.3.0 View file →
@@ -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' ),
@@ -106,43 +107,116 @@
106 107 ],
107 108 ],
108 109 [
109 110 'type' => 'select',
110 - 'group' => 'main',
111 + 'group' => 'renewals',
111 112 'priority' => 9,
112 113 'field_data' => [
113 - 'id' => 'subscrpt_cancellation_delay',
114 - 'title' => __( 'Cancellation Timing', 'subscription' ),
115 - 'description' => __( 'When a subscription is cancelled, choose when it actually ends.', 'subscription' ),
114 + 'id' => 'subscrpt_early_renew_visibility',
115 + 'title' => __( 'Early Renew Button Visibility', 'subscription' ),
116 + 'description' => __( 'Choose when customers see the Early Renew button on an active subscription.', 'subscription' ),
116 117 'options' => [
117 - '24h' => __( 'After 24 hours', 'subscription' ),
118 - 'instant' => __( 'Immediately', 'subscription' ),
119 - 'period' => __( 'At end of billing period (before next renewal)', 'subscription' ),
118 + 'always' => __( 'Always', 'subscription' ),
119 + 'before_days' => __( 'Before X days of the next renewal', 'subscription' ),
120 + 'day_of_month' => __( 'From a fixed day of the month', 'subscription' ),
121 + 'cycle_left' => __( 'When a percentage of the billing cycle remains', 'subscription' ),
120 122 ],
121 - 'selected' => esc_attr( \SpringDevs\Subscription\Illuminate\Cancellation::get_settings( 'subscrpt_cancellation_delay' ) ),
123 + 'selected' => esc_attr( get_option( 'subscrpt_early_renew_visibility', 'always' ) ),
122 124 ],
123 125 ],
124 126 [
125 - 'type' => 'editlist',
126 - 'group' => 'main',
127 - 'priority' => 9.6,
127 + 'type' => 'input',
128 + 'group' => 'renewals',
129 + 'priority' => 10,
128 130 'field_data' => [
129 - 'id' => 'subscrpt_cancellation_reasons',
130 - 'title' => __( 'Cancellation Reasons', 'subscription' ),
131 - 'description' => __( 'Reasons offered in the cancellation survey form. Shown when Cancellation Survey is enabled.', 'subscription' ),
132 - 'value' => \SpringDevs\Subscription\Illuminate\Cancellation::get_reasons(),
133 - 'modal' => true,
134 - 'button_label' => __( 'Manage reasons', 'subscription' ),
135 - 'modal_title' => __( 'Cancellation Reasons', 'subscription' ),
136 - 'add_placeholder' => __( 'Add a reason…', 'subscription' ),
137 - 'add_label' => __( 'Add reason', 'subscription' ),
138 - 'empty_text' => __( 'No reasons yet. Add one below.', 'subscription' ),
131 + 'id' => 'subscrpt_early_renew_before_days',
132 + 'title' => __( 'Early Renew: Days Before Renewal', 'subscription' ),
133 + 'description' => __( 'Used with "Before X days". The button shows this many days before the next renewal date.', 'subscription' ),
134 + 'value' => esc_attr( get_option( 'subscrpt_early_renew_before_days', '7' ) ),
135 + 'type' => 'number',
136 + 'attributes' => [
137 + 'min' => 1,
138 + ],
139 139 ],
140 140 ],
141 + [
142 + 'type' => 'input',
143 + 'group' => 'renewals',
144 + 'priority' => 11,
145 + 'field_data' => [
146 + 'id' => 'subscrpt_early_renew_day_of_month',
147 + 'title' => __( 'Early Renew: Day of Month', 'subscription' ),
148 + 'description' => __( 'Used with "From a fixed day of the month". The button shows from this day until the end of each month. Short months use their last day.', 'subscription' ),
149 + 'value' => esc_attr( get_option( 'subscrpt_early_renew_day_of_month', '25' ) ),
150 + 'type' => 'number',
151 + 'attributes' => [
152 + 'min' => 1,
153 + 'max' => 31,
154 + ],
155 + ],
156 + ],
157 + [
158 + 'type' => 'input',
159 + 'group' => 'renewals',
160 + 'priority' => 12,
161 + 'field_data' => [
162 + 'id' => 'subscrpt_early_renew_cycle_left',
163 + 'title' => __( 'Early Renew: Cycle Remaining (%)', 'subscription' ),
164 + 'description' => __( 'Used with "When a percentage of the billing cycle remains". The button shows once this percentage of the current cycle or less is left.', 'subscription' ),
165 + 'value' => esc_attr( get_option( 'subscrpt_early_renew_cycle_left', '20' ) ),
166 + 'type' => 'number',
167 + 'attributes' => [
168 + 'min' => 1,
169 + 'max' => 100,
170 + ],
171 + ],
172 + ],
141 173 ];
142 174 }
143 175
144 176 /**
177 + * Module: License integrations (Integrations/LicenseManagerWoo.php).
178 + *
179 + * @return array
180 + */
181 + private function license_fields() {
182 + return [
183 + [
184 + 'type' => 'heading',
185 + 'group' => 'license_settings',
186 + 'priority' => 4,
187 + 'field_data' => [
188 + 'title' => __( 'License Settings', 'subscription' ),
189 + ],
190 + ],
191 + [
192 + 'type' => 'toggle',
193 + 'group' => 'license_settings',
194 + 'priority' => 1,
195 + 'field_data' => [
196 + 'id' => 'subscrpt_regenerate_license_on_renewal',
197 + 'title' => __( 'Regenerate License on Renewal', 'subscription' ),
198 + 'description' => __( 'Enable this option if you want to invalidate the old key and issue a fresh license key whenever a subscription renews.', 'subscription' ),
199 + 'value' => '1',
200 + 'checked' => '1' === get_option( 'subscrpt_regenerate_license_on_renewal', '0' ),
201 + ],
202 + ],
203 + [
204 + 'type' => 'toggle',
205 + 'group' => 'license_settings',
206 + 'priority' => 2,
207 + 'field_data' => [
208 + 'id' => 'subscrpt_deactivate_old_license_on_renewal',
209 + 'title' => __( 'Deactivate Previous License', 'subscription' ),
210 + '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' ),
211 + 'value' => '1',
212 + 'checked' => '1' === get_option( 'subscrpt_deactivate_old_license_on_renewal', '1' ),
213 + ],
214 + ],
215 + ];
216 + }
217 +
218 + /**
145 219 * Module: Grace Period (Admin/Settings.php).
146 220 *
147 221 * @return array
148 222 */
@@ -150,9 +224,9 @@
150 224 return [
151 225 [
152 226 'type' => 'heading',
153 227 'group' => 'grace_period',
154 - 'priority' => 3,
228 + 'priority' => 5,
155 229 'field_data' => [
156 230 'title' => __( 'Grace Period Settings', 'subscription' ),
157 231 ],
158 232 ],
@@ -213,9 +287,9 @@
213 287 return [
214 288 [
215 289 'type' => 'heading',
216 290 'group' => 'payment_failure',
217 - 'priority' => 4,
291 + 'priority' => 6,
218 292 'field_data' => [
219 293 'title' => __( 'Payment Failure Handling', 'subscription' ),
220 294 ],
221 295 ],
@@ -349,9 +423,9 @@
349 423 return [
350 424 [
351 425 'type' => 'heading',
352 426 'group' => 'health_queue',
353 - 'priority' => 8,
427 + 'priority' => 9,
354 428 'field_data' => [
355 429 'title' => __( 'Subscription Health', 'subscription' ),
356 430 ],
357 431 ],
@@ -393,8 +467,21 @@
393 467 'value' => '1',
394 468 'checked' => '1' === get_option( 'wp_subscription_auto_complete_order', '1' ),
395 469 ],
396 470 ],
471 + [
472 + 'type' => 'toggle',
473 + 'group' => 'payment_gateways',
474 + 'priority' => 2,
475 + 'field_data' => [
476 + 'id' => 'subscrpt_require_payment_on_trial',
477 + 'title' => __( 'Require Payment for Free Trials', 'subscription' ),
478 + 'label' => __( 'Collect payment details at checkout for trial subscriptions', 'subscription' ),
479 + 'description' => __( 'Collect payment details up front on free trials so renewals charge automatically.', 'subscription' ),
480 + 'value' => '1',
481 + 'checked' => '1' === get_option( 'subscrpt_require_payment_on_trial', '1' ),
482 + ],
483 + ],
397 484 ];
398 485 }
399 486
400 487 /**
@@ -404,10 +491,18 @@
404 491 */
405 492 private function switch_fields() {
406 493 return [
407 494 [
495 + 'type' => 'heading',
496 + 'group' => 'switching',
497 + 'priority' => 3,
498 + 'field_data' => [
499 + 'title' => __( 'Switching & Upgrades', 'subscription' ),
500 + ],
501 + ],
502 + [
408 503 'type' => 'toggle',
409 - 'group' => 'general',
504 + 'group' => 'switching',
410 505 'priority' => 9,
411 506 'field_data' => [
412 507 'id' => 'subscrpt_switch_enabled',
413 508 'title' => __( 'Switch Subscription', 'subscription' ),
@@ -418,9 +513,9 @@
418 513 ],
419 514 ],
420 515 [
421 516 'type' => 'toggle',
422 - 'group' => 'general',
517 + 'group' => 'switching',
423 518 'priority' => 10,
424 519 'field_data' => [
425 520 'id' => 'subscrpt_downgrade_allowed',
426 521 'title' => __( 'Downgrade Subscription', 'subscription' ),
@@ -431,9 +526,9 @@
431 526 ],
432 527 ],
433 528 [
434 529 'type' => 'join',
435 - 'group' => 'general',
530 + 'group' => 'switching',
436 531 'priority' => 11,
437 532 'field_data' => [
438 533 'title' => __( 'Switch Fee', 'subscription' ),
439 534 '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' ),
@@ -471,9 +566,9 @@
471 566 ],
472 567 ],
473 568 [
474 569 'type' => 'select',
475 - 'group' => 'general',
570 + 'group' => 'switching',
476 571 'priority' => 12,
477 572 'field_data' => [
478 573 'id' => 'subscrpt_switch_fee_apply_to',
479 574 'title' => __( 'Apply Fee To', 'subscription' ),
@@ -498,9 +593,9 @@
498 593 return [
499 594 [
500 595 'type' => 'heading',
501 596 'group' => 'role_based_settings',
502 - 'priority' => 6,
597 + 'priority' => 7,
503 598 'field_data' => [
504 599 'title' => __( 'Role-Based Settings', 'subscription' ),
505 600 ],
506 601 ],
@@ -528,9 +623,9 @@
528 623 return [
529 624 [
530 625 'type' => 'heading',
531 626 'group' => 'live_qr_settings',
532 - 'priority' => 5,
627 + 'priority' => 8,
533 628 'field_data' => [
534 629 'title' => __( 'Quick Details QR Settings', 'subscription' ),
535 630 ],
536 631 ],
@@ -601,9 +696,9 @@
601 696 return [
602 697 [
603 698 'type' => 'heading',
604 699 'group' => 'payment_gateways',
605 - 'priority' => 0.1,
700 + 'priority' => 1,
606 701 'field_data' => [
607 702 'title' => __( 'Payment Gateway Settings', 'subscription' ),
608 703 ],
609 704 ],