PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 1.10.4
Subscriptions for WooCommerce with Stripe Recurring Payments v1.10.4
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 1.4.1 1.4.2 1.5.0 1.5.1 All 61 releases
subscription / includes / Admin / views / onboarding-wizard.php

onboarding-wizard.php in Subscriptions for WooCommerce with Stripe Recurring Payments 1.10.4, at includes/Admin/views/onboarding-wizard.php

1,588 lines 48.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Onboarding Wizard Template
4 * SPA-style: all pages rendered at once, JS controls visibility
5 *
6 * @package SpringDevs\Subscription\Admin
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 // Get wizard data from session
14 $session_data = isset( $_SESSION['subscrpt_onboarding_wizard'] ) ? $_SESSION['subscrpt_onboarding_wizard'] : array();
15 $wizard_page = isset( $session_data['page'] ) ? (int) $session_data['page'] : 1;
16 $product_id = isset( $session_data['product_id'] ) ? (int) $session_data['product_id'] : 0;
17 $subscriptions_url = admin_url( 'admin.php?page=wp-subscription' );
18 $is_pro = subscrpt_pro_activated();
19
20 // Get existing products for dropdown
21 $args = array(
22 'post_type' => 'product',
23 'posts_per_page' => -1,
24 'post_status' => 'any',
25 'orderby' => 'title',
26 'order' => 'ASC',
27 );
28 $products = get_posts( $args );
29
30 // Load product if exists
31 $product = null;
32 if ( $product_id > 0 ) {
33 $product = wc_get_product( $product_id );
34 }
35 ?>
36 <style>
37 #subscrpt-onboarding-wizard {
38 max-width: 680px;
39 }
40 #subscrpt-onboarding-wizard:has(#subscrpt-section-1.active),
41 #subscrpt-onboarding-wizard:has(#subscrpt-section-2.active) {
42 max-width: 900px;
43 }
44 /* Page sections — all rendered, JS toggles visibility */
45 .wizard-section {
46 display: none;
47 }
48 .wizard-section.active {
49 display: block;
50 }
51 /* Stepper */
52 .wpsubs-wizard-stepper {
53 display: flex;
54 align-items: center;
55 width: fit-content;
56 margin: 0 auto 32px;
57 gap: 0;
58 }
59 .wpsubs-wizard-stepper__step {
60 display: flex;
61 align-items: center;
62 gap: 10px;
63 }
64 .wpsubs-wizard-stepper__num {
65 width: 28px;
66 height: 28px;
67 border-radius: 50%;
68 background: var(--wpsubs-surface-muted);
69 border: 1.5px solid var(--wpsubs-border);
70 display: flex;
71 align-items: center;
72 justify-content: center;
73 font-size: 12px;
74 font-weight: 600;
75 color: var(--wpsubs-text-muted);
76 flex-shrink: 0;
77 transition: all 0.2s;
78 }
79 .wpsubs-wizard-stepper__step.active .wpsubs-wizard-stepper__num {
80 background: var(--wpsubs-brand);
81 border-color: var(--wpsubs-brand);
82 color: var(--wpsubs-surface);
83 }
84 .wpsubs-wizard-stepper__step.done .wpsubs-wizard-stepper__num {
85 background: var(--wpsubs-brand);
86 border-color: var(--wpsubs-brand);
87 color: transparent;
88 position: relative;
89 }
90 .wpsubs-wizard-stepper__step.done .wpsubs-wizard-stepper__num::after {
91 content: "✓";
92 position: absolute;
93 color: var(--wpsubs-surface);
94 font-size: 11px;
95 font-weight: 700;
96 top: 50%;
97 left: 50%;
98 transform: translate(-50%, -50%);
99 }
100 .wpsubs-wizard-stepper__step.done + .wpsubs-wizard-stepper__line {
101 background: var(--wpsubs-brand);
102 }
103 .wpsubs-wizard-stepper__label {
104 font-size: 13px;
105 font-weight: 500;
106 color: var(--wpsubs-text-muted);
107 white-space: nowrap;
108 transition: color 0.2s;
109 }
110 .wpsubs-wizard-stepper__step.active .wpsubs-wizard-stepper__label {
111 color: var(--wpsubs-brand);
112 }
113 .wpsubs-wizard-stepper__line {
114 width: 48px;
115 flex-shrink: 0;
116 height: 1px;
117 background: var(--wpsubs-border);
118 margin: 0 8px;
119 }
120 /* Card */
121 .wizard-card {
122 background: var(--wpsubs-surface);
123 border: 1px solid var(--wpsubs-border);
124 border-radius: var(--wpsubs-radius);
125 padding: 28px 32px;
126 margin-bottom: 16px;
127 }
128 /* Form rows (shared) */
129 .form-row {
130 margin-bottom: 16px;
131 }
132 .form-row label {
133 display: block;
134 font-size: 13px;
135 font-weight: 500;
136 color: var(--wpsubs-text);
137 margin-bottom: 6px;
138 }
139 /* Page 2 */
140 .p2-page-title {
141 font-size: 22px;
142 font-weight: 800;
143 color: var(--wpsubs-text);
144 margin: 0 0 8px;
145 line-height: 1.25;
146 }
147 .p2-page-subtitle {
148 font-size: 13.5px;
149 color: var(--wpsubs-text-muted);
150 line-height: 1.6;
151 margin: 0 0 28px;
152 }
153 .p2-section-block {
154 margin-bottom: 28px;
155 }
156 .p2-section-label {
157 font-size: 14px;
158 font-weight: 700;
159 color: var(--wpsubs-text);
160 margin: 0 0 4px;
161 }
162 .p2-section-desc {
163 font-size: 13px;
164 color: var(--wpsubs-text-muted);
165 margin: 0 0 14px;
166 }
167 /* Option cards */
168 .p2-option-cards {
169 display: grid;
170 grid-template-columns: 1fr 1fr;
171 gap: 12px;
172 margin-bottom: 12px;
173 }
174 .p2-option-card {
175 position: relative;
176 display: flex;
177 flex-direction: column;
178 gap: 6px;
179 padding: 16px;
180 border: 1px solid var(--wpsubs-border);
181 border-radius: var(--wpsubs-radius);
182 background: var(--wpsubs-surface);
183 cursor: pointer;
184 text-align: left;
185 transition: border-color 0.15s, background 0.15s;
186 }
187 .p2-option-card:hover {
188 border-color: var(--wpsubs-brand);
189 }
190 .p2-option-card.active {
191 border-color: var(--wpsubs-brand);
192 background: var(--wpsubs-brand-light);
193 }
194 .p2-option-card__check {
195 position: absolute;
196 top: 10px;
197 right: 10px;
198 width: 20px;
199 height: 20px;
200 border-radius: 50%;
201 background: var(--wpsubs-brand);
202 display: none;
203 align-items: center;
204 justify-content: center;
205 color: var(--wpsubs-surface);
206 font-size: 11px;
207 font-weight: 700;
208 }
209 .p2-option-card.active .p2-option-card__check {
210 display: flex;
211 }
212 .p2-option-card__icon {
213 width: 32px;
214 height: 32px;
215 border-radius: 6px;
216 border: 1px solid var(--wpsubs-border);
217 background: var(--wpsubs-surface);
218 display: flex;
219 align-items: center;
220 justify-content: center;
221 color: var(--wpsubs-text-muted);
222 margin-bottom: 4px;
223 }
224 .p2-option-card.active .p2-option-card__icon {
225 border-color: var(--wpsubs-brand);
226 color: var(--wpsubs-brand);
227 }
228 .p2-option-card__title {
229 font-size: 13px;
230 font-weight: 700;
231 color: var(--wpsubs-text);
232 margin: 0;
233 }
234 .p2-option-card__desc {
235 font-size: 12px;
236 color: var(--wpsubs-text-muted);
237 margin: 0;
238 line-height: 1.5;
239 }
240 /* Selected product chip */
241 .p2-selected-product {
242 display: flex;
243 align-items: center;
244 gap: 12px;
245 padding: 10px 14px;
246 border: 1px solid var(--wpsubs-border);
247 border-radius: var(--wpsubs-radius);
248 background: var(--wpsubs-surface);
249 margin-bottom: 4px;
250 }
251 .p2-selected-product__avatar {
252 width: 36px;
253 height: 36px;
254 border-radius: 6px;
255 background: var(--wpsubs-surface-muted);
256 border: 1px solid var(--wpsubs-border);
257 display: flex;
258 align-items: center;
259 justify-content: center;
260 font-size: 11px;
261 font-weight: 700;
262 color: var(--wpsubs-text-muted);
263 flex-shrink: 0;
264 }
265 .p2-selected-product__info {
266 flex: 1;
267 min-width: 0;
268 }
269 .p2-selected-product__name {
270 font-size: 13px;
271 font-weight: 600;
272 color: var(--wpsubs-text);
273 margin: 0 0 2px;
274 white-space: nowrap;
275 overflow: hidden;
276 text-overflow: ellipsis;
277 }
278 .p2-selected-product__meta {
279 font-size: 12px;
280 color: var(--wpsubs-text-muted);
281 margin: 0;
282 }
283 .p2-selected-product__clear {
284 background: none;
285 border: none;
286 cursor: pointer;
287 color: var(--wpsubs-text-muted);
288 font-size: 18px;
289 line-height: 1;
290 padding: 0 4px;
291 flex-shrink: 0;
292 transition: color 0.15s;
293 }
294 .p2-selected-product__clear:hover {
295 color: var(--wpsubs-text);
296 }
297 /* Section 2 body */
298 .p2-body {
299 display: grid;
300 grid-template-columns: 1fr 260px;
301 gap: 32px;
302 align-items: start;
303 }
304 .p2-form-grid {
305 display: grid;
306 grid-template-columns: 1fr 1fr;
307 gap: 16px;
308 margin-bottom: 16px;
309 }
310 .p2-form-grid .form-row {
311 margin-bottom: 0;
312 }
313 .p2-input-wrap {
314 position: relative;
315 }
316 .p2-input-prefix {
317 position: absolute;
318 left: 11px;
319 top: 50%;
320 transform: translateY(-50%);
321 font-size: 13px;
322 color: var(--wpsubs-text-muted);
323 pointer-events: none;
324 z-index: 1;
325 }
326 .p2-input-prefix + .wpsubs-input {
327 padding-left: 24px !important;
328 }
329 .p2-input-suffix {
330 position: absolute;
331 right: 11px;
332 top: 50%;
333 transform: translateY(-50%);
334 font-size: 13px;
335 color: var(--wpsubs-text-muted);
336 pointer-events: none;
337 }
338 .p2-input-suffix-input {
339 padding-right: 44px !important;
340 }
341 .p2-field-hint {
342 font-size: 12px;
343 color: var(--wpsubs-text-muted);
344 margin-top: 5px;
345 line-height: 1.4;
346 }
347 .p2-label-optional {
348 font-weight: 400;
349 color: var(--wpsubs-text-subtle);
350 font-size: 12px;
351 margin-left: 4px;
352 }
353 /* Page 2 right preview */
354 .p2-preview-col {
355 position: sticky;
356 top: 80px;
357 }
358 .p2-preview-col-label {
359 font-size: 11px;
360 font-weight: 700;
361 letter-spacing: 0.08em;
362 text-transform: uppercase;
363 color: var(--wpsubs-text-muted);
364 margin: 0 0 10px;
365 }
366 .p2-preview-col-desc {
367 font-size: 12px;
368 color: var(--wpsubs-text-muted);
369 line-height: 1.5;
370 margin-top: 10px;
371 }
372 /* Page 2 nav (outside card) */
373 .p2-nav {
374 display: flex;
375 align-items: center;
376 justify-content: space-between;
377 margin-top: 16px;
378 }
379 .p2-nav-back {
380 background: none;
381 border: none;
382 cursor: pointer;
383 font-size: 13px;
384 color: var(--wpsubs-text-muted);
385 display: flex;
386 align-items: center;
387 gap: 4px;
388 padding: 0;
389 transition: color 0.15s;
390 }
391 .p2-nav-back:hover {
392 color: var(--wpsubs-text);
393 }
394 /* Product search */
395 .p2-product-search {
396 position: relative;
397 }
398 .p2-product-search__input-wrap {
399 display: flex;
400 align-items: center;
401 gap: 8px;
402 border: 1px solid var(--wpsubs-border);
403 border-radius: var(--wpsubs-radius);
404 padding: 0 12px;
405 background: var(--wpsubs-surface);
406 transition: border-color 0.15s, box-shadow 0.15s;
407 }
408 .p2-product-search__input-wrap:focus-within {
409 border-color: var(--wpsubs-brand);
410 box-shadow: 0 0 0 3px var(--wpsubs-brand-ring);
411 }
412 .p2-product-search__icon {
413 color: var(--wpsubs-text-muted);
414 flex-shrink: 0;
415 }
416 .p2-product-search__input,
417 .p2-product-search__input:focus {
418 flex: 1;
419 border: none !important;
420 outline: none !important;
421 box-shadow: none !important;
422 padding: 9px 0 !important;
423 font-size: 13px;
424 background: transparent !important;
425 }
426 .p2-product-search__dropdown {
427 position: absolute;
428 top: calc(100% + 4px);
429 left: 0;
430 right: 0;
431 background: var(--wpsubs-surface);
432 border: 1px solid var(--wpsubs-border);
433 border-radius: var(--wpsubs-radius);
434 box-shadow: var(--wpsubs-shadow-md);
435 z-index: 999;
436 max-height: 300px;
437 overflow-y: auto;
438 padding: 4px;
439 }
440 .p2-product-search__item {
441 display: flex;
442 align-items: center;
443 gap: 12px;
444 padding: 9px 10px;
445 border-radius: var(--wpsubs-radius-sm);
446 cursor: pointer;
447 transition: background 0.1s;
448 }
449 .p2-product-search__item:hover {
450 background: var(--wpsubs-surface-muted);
451 }
452 .p2-product-search__avatar {
453 width: 36px;
454 height: 36px;
455 border-radius: 8px;
456 display: flex;
457 align-items: center;
458 justify-content: center;
459 font-size: 12px;
460 font-weight: 700;
461 flex-shrink: 0;
462 }
463 .p2-product-search__info {
464 flex: 1;
465 min-width: 0;
466 }
467 .p2-product-search__name {
468 font-size: 13px;
469 font-weight: 600;
470 color: var(--wpsubs-text);
471 margin: 0 0 2px;
472 white-space: nowrap;
473 overflow: hidden;
474 text-overflow: ellipsis;
475 }
476 .p2-product-search__meta {
477 font-size: 12px;
478 color: var(--wpsubs-text-muted);
479 margin: 0;
480 }
481 .p2-product-search__price {
482 font-size: 13px;
483 font-weight: 600;
484 color: var(--wpsubs-text);
485 white-space: nowrap;
486 flex-shrink: 0;
487 }
488 .p2-product-search__empty {
489 padding: 12px 10px;
490 font-size: 13px;
491 color: var(--wpsubs-text-muted);
492 text-align: center;
493 }
494 .p2-product-search__item--locked {
495 opacity: 0.55;
496 cursor: not-allowed;
497 }
498 /* Billing every group — number input + standalone adv-select */
499 .p2-billing-group {
500 width: 100%;
501 }
502 .p2-billing-group .p2-billing-per-input {
503 flex-grow: 1;
504 }
505 #subscrpt-billing-period-select {
506 width: 100%;
507 }
508 /* Pro badge + locked fields */
509 .p2-pro-badge {
510 display: inline-flex;
511 align-items: center;
512 background: var(--wpsubs-brand);
513 color: var(--wpsubs-surface);
514 font-size: 10px;
515 font-weight: 700;
516 padding: 2px 6px;
517 border-radius: 3px;
518 text-transform: uppercase;
519 letter-spacing: 0.04em;
520 margin-left: 6px;
521 vertical-align: middle;
522 }
523 .p2-field-pro-locked {
524 opacity: 0.6;
525 }
526 /* Variation picker */
527 .p2-variation-picker {
528 margin-top: 12px;
529 }
530 .p2-variation-picker__label {
531 font-size: 11px;
532 font-weight: 700;
533 letter-spacing: 0.06em;
534 text-transform: uppercase;
535 color: var(--wpsubs-text-muted);
536 margin: 0 0 8px;
537 }
538 .p2-variation-picker__loading {
539 font-size: 13px;
540 color: var(--wpsubs-text-muted);
541 padding: 10px 0;
542 }
543 .p2-variation-picker__list {
544 border: 1px solid var(--wpsubs-border);
545 border-radius: var(--wpsubs-radius);
546 overflow: hidden;
547 }
548 .p2-variation-item {
549 display: flex;
550 align-items: center;
551 gap: 12px;
552 padding: 10px 12px;
553 cursor: pointer;
554 transition: background 0.1s;
555 border-bottom: 1px solid var(--wpsubs-border);
556 }
557 .p2-variation-item:last-child {
558 border-bottom: none;
559 }
560 .p2-variation-item:hover {
561 background: var(--wpsubs-surface-muted);
562 }
563 .p2-variation-item.selected {
564 background: var(--wpsubs-brand-light);
565 }
566 .p2-variation-item__check {
567 width: 18px;
568 height: 18px;
569 border-radius: 50%;
570 border: 1.5px solid var(--wpsubs-border);
571 flex-shrink: 0;
572 display: flex;
573 align-items: center;
574 justify-content: center;
575 font-size: 10px;
576 font-weight: 700;
577 color: transparent;
578 transition: all 0.15s;
579 }
580 .p2-variation-item.selected .p2-variation-item__check {
581 background: var(--wpsubs-brand);
582 border-color: var(--wpsubs-brand);
583 color: var(--wpsubs-surface);
584 }
585 .p2-variation-item__info {
586 flex: 1;
587 min-width: 0;
588 }
589 .p2-variation-item__name {
590 font-size: 13px;
591 font-weight: 500;
592 color: var(--wpsubs-text);
593 margin: 0;
594 white-space: nowrap;
595 overflow: hidden;
596 text-overflow: ellipsis;
597 }
598 .p2-variation-item__meta {
599 font-size: 12px;
600 color: var(--wpsubs-text-muted);
601 margin: 0;
602 }
603 .p2-variation-item__price {
604 font-size: 13px;
605 font-weight: 600;
606 color: var(--wpsubs-text);
607 white-space: nowrap;
608 flex-shrink: 0;
609 }
610 /* Page 3 */
611 .p3-card {
612 text-align: center;
613 padding: 40px 40px 32px;
614 }
615 .p3-success-icon {
616 width: 52px;
617 height: 52px;
618 border-radius: 50%;
619 background: var(--wpsubs-brand);
620 display: flex;
621 align-items: center;
622 justify-content: center;
623 margin: 0 auto 20px;
624 }
625 .p3-heading {
626 font-size: 24px;
627 font-weight: 700;
628 color: var(--wpsubs-text);
629 margin-bottom: 10px;
630 }
631 .p3-subtext {
632 font-size: 13.5px;
633 color: var(--wpsubs-text-muted);
634 line-height: 1.6;
635 max-width: 440px;
636 margin: 0 auto 28px;
637 }
638 /* Product card */
639 .p3-product-card {
640 border: 1px solid var(--wpsubs-border);
641 border-radius: var(--wpsubs-radius);
642 overflow: hidden;
643 margin-bottom: 24px;
644 text-align: left;
645 }
646 .p3-product-card__header {
647 display: grid;
648 grid-template-columns: 1fr 160px 110px;
649 padding: 8px 16px;
650 border-bottom: 1px solid var(--wpsubs-border);
651 }
652 .p3-product-card__header span {
653 font-size: 10px;
654 font-weight: 600;
655 letter-spacing: 0.06em;
656 color: var(--wpsubs-text-muted);
657 text-transform: uppercase;
658 }
659 .p3-product-card__row {
660 display: grid;
661 grid-template-columns: 1fr 160px 110px;
662 align-items: center;
663 padding: 14px 16px;
664 }
665 .p3-product-card__product {
666 display: flex;
667 align-items: center;
668 gap: 12px;
669 }
670 .p3-product-avatar {
671 width: 36px;
672 height: 36px;
673 border-radius: 6px;
674 background: #fde8d8;
675 color: #c2440f;
676 font-size: 12px;
677 font-weight: 700;
678 display: flex;
679 align-items: center;
680 justify-content: center;
681 flex-shrink: 0;
682 }
683 .p3-product-name {
684 font-size: 13px;
685 font-weight: 600;
686 color: var(--wpsubs-text);
687 margin: 0 0 2px;
688 }
689 .p3-product-meta {
690 font-size: 11.5px;
691 color: var(--wpsubs-text-muted);
692 margin: 0;
693 }
694 .p3-product-card__status {
695 display: flex;
696 flex-direction: column;
697 gap: 4px;
698 }
699 .p3-status-badge {
700 display: inline-flex;
701 align-items: center;
702 gap: 5px;
703 background: #ecfdf5;
704 color: #065f46;
705 font-size: 12px;
706 font-weight: 500;
707 padding: 3px 8px 3px 6px;
708 border-radius: 12px;
709 width: fit-content;
710 }
711 .p3-status-badge__dot {
712 width: 6px;
713 height: 6px;
714 border-radius: 50%;
715 background: #10b981;
716 flex-shrink: 0;
717 }
718 .p3-status-sub {
719 font-size: 11.5px;
720 color: var(--wpsubs-text-muted);
721 margin: 0;
722 }
723 .p3-product-card__price {
724 text-align: right;
725 }
726 .p3-price-amount {
727 display: block;
728 font-size: 15px;
729 font-weight: 700;
730 color: var(--wpsubs-text);
731 }
732 .p3-price-period {
733 font-size: 11.5px;
734 color: var(--wpsubs-text-muted);
735 }
736 /* What now section */
737 .p3-what-now-label {
738 font-size: 10.5px;
739 font-weight: 700;
740 letter-spacing: 0.08em;
741 color: var(--wpsubs-text-muted);
742 text-transform: uppercase;
743 text-align: left;
744 margin-bottom: 8px;
745 }
746 .p3-action-rows {
747 display: flex;
748 flex-direction: column;
749 gap: 0;
750 border: 1px solid var(--wpsubs-border);
751 border-radius: var(--wpsubs-radius);
752 overflow: hidden;
753 margin-bottom: 20px;
754 }
755 .p3-action-row {
756 display: flex;
757 align-items: center;
758 gap: 14px;
759 padding: 14px 16px;
760 background: var(--wpsubs-surface);
761 text-decoration: none;
762 text-align: left;
763 border: none;
764 cursor: pointer;
765 width: 100%;
766 box-sizing: border-box;
767 transition: background 0.12s;
768 font-family: inherit;
769 }
770 .p3-action-row + .p3-action-row {
771 border-top: 1px solid var(--wpsubs-border);
772 }
773 .p3-action-row:hover {
774 background: var(--wpsubs-surface-muted);
775 }
776 .p3-action-row__icon {
777 width: 34px;
778 height: 34px;
779 border: 1px solid var(--wpsubs-border);
780 border-radius: var(--wpsubs-radius-sm);
781 background: var(--wpsubs-surface-muted);
782 display: flex;
783 align-items: center;
784 justify-content: center;
785 flex-shrink: 0;
786 color: var(--wpsubs-text-muted);
787 }
788 .p3-action-row__content {
789 flex: 1;
790 min-width: 0;
791 }
792 .p3-action-row__title {
793 font-size: 13px;
794 font-weight: 600;
795 color: var(--wpsubs-text);
796 margin: 0 0 2px;
797 }
798 .p3-action-row__desc {
799 font-size: 12px;
800 color: var(--wpsubs-text-muted);
801 margin: 0;
802 }
803 .p3-action-row__chevron {
804 color: var(--wpsubs-text-subtle);
805 flex-shrink: 0;
806 }
807 /* Help footer */
808 .p3-help-text {
809 font-size: 12.5px;
810 color: var(--wpsubs-text-muted);
811 text-align: center;
812 }
813 .p3-help-link {
814 color: var(--wpsubs-brand);
815 text-decoration: none;
816 }
817 .p3-help-link:hover {
818 text-decoration: underline;
819 }
820 /* Page 3 nav */
821 .p3-nav {
822 display: flex;
823 align-items: center;
824 justify-content: flex-end;
825 gap: 10px;
826 margin-top: 16px;
827 }
828 .p3-nav .wpsubs-btn {
829 min-width: 140px;
830 height: 36px;
831 box-sizing: border-box;
832 }
833 /* Page 1 specific — two-column hero layout */
834 #subscrpt-section-1 {
835 max-width: 860px;
836 }
837 #subscrpt-section-1 .wizard-card {
838 padding: 56px 48px;
839 display: grid;
840 grid-template-columns: 1fr 1fr;
841 gap: 64px;
842 align-items: center;
843 }
844 .p1-left {
845 display: flex;
846 flex-direction: column;
847 gap: 0;
848 }
849 .p1-badge {
850 display: inline-flex;
851 align-items: center;
852 gap: 6px;
853 background: var(--wpsubs-brand-light);
854 color: var(--wpsubs-brand);
855 font-size: 12px;
856 font-weight: 600;
857 padding: 4px 10px;
858 border-radius: 20px;
859 border: 1px solid var(--wpsubs-border);
860 margin-bottom: 20px;
861 width: fit-content;
862 }
863 .p1-badge__dot {
864 width: 7px;
865 height: 7px;
866 border-radius: 50%;
867 background: var(--wpsubs-brand);
868 flex-shrink: 0;
869 }
870 .p1-heading {
871 font-size: 26px;
872 font-weight: 800;
873 color: var(--wpsubs-text);
874 line-height: 1.25;
875 margin: 0 0 20px;
876 }
877 .p1-heading__accent {
878 color: var(--wpsubs-brand);
879 }
880 .p1-desc {
881 font-size: 13.5px;
882 color: var(--wpsubs-text-muted);
883 line-height: 1.6;
884 margin: 0 0 24px;
885 }
886 .p1-bullets {
887 list-style: none;
888 padding: 0;
889 margin: 0 0 36px;
890 display: flex;
891 flex-direction: column;
892 gap: 12px;
893 }
894 .p1-bullets li {
895 display: flex;
896 align-items: center;
897 gap: 8px;
898 font-size: 13px;
899 color: var(--wpsubs-text);
900 }
901 .p1-bullet-dot {
902 width: 7px;
903 height: 7px;
904 border-radius: 50%;
905 background: var(--wpsubs-brand);
906 flex-shrink: 0;
907 }
908 .p1-actions {
909 display: flex;
910 align-items: center;
911 gap: 16px;
912 flex-wrap: wrap;
913 }
914 .p1-skip {
915 font-size: 13px;
916 color: var(--wpsubs-text-muted);
917 background: none;
918 border: none;
919 cursor: pointer;
920 padding: 0;
921 text-decoration: none;
922 }
923 .p1-skip:hover {
924 color: var(--wpsubs-text);
925 }
926 /* Right — product preview mockup */
927 .p1-right {
928 background: var(--wpsubs-surface-muted);
929 border-radius: var(--wpsubs-radius);
930 padding: 20px 20px 14px;
931 border: 1px solid var(--wpsubs-border);
932 transform: rotate(-3deg);
933 transform-origin: center center;
934 }
935 .p1-preview-label {
936 font-size: 13px;
937 font-weight: 600;
938 color: var(--wpsubs-text);
939 margin: 0 0 2px;
940 }
941 .p1-preview-sublabel {
942 font-size: 12px;
943 color: var(--wpsubs-text-muted);
944 margin: 0 0 16px;
945 }
946 .p1-preview-card {
947 background: var(--wpsubs-surface);
948 border-radius: var(--wpsubs-radius);
949 border: 1px solid var(--wpsubs-border);
950 overflow: hidden;
951 box-shadow: var(--wpsubs-shadow-md);
952 }
953 .p1-preview-img {
954 width: 100%;
955 height: 100px;
956 background: linear-gradient(135deg, var(--wpsubs-brand-light) 0%, var(--wpsubs-surface-muted) 100%);
957 display: flex;
958 align-items: center;
959 justify-content: center;
960 flex-direction: column;
961 gap: 6px;
962 border-bottom: 1px solid var(--wpsubs-border);
963 }
964 .p1-preview-img svg {
965 width: 36px;
966 height: 36px;
967 color: var(--wpsubs-brand);
968 opacity: 0.8;
969 }
970 .p1-preview-img__dots {
971 display: flex;
972 gap: 4px;
973 }
974 .p1-preview-img__dots span {
975 width: 5px;
976 height: 5px;
977 border-radius: 50%;
978 background: var(--wpsubs-brand);
979 opacity: 0.3;
980 }
981 .p1-preview-body {
982 padding: 14px;
983 }
984 .p1-preview-name {
985 font-size: 13px;
986 font-weight: 700;
987 text-align: center;
988 color: var(--wpsubs-text);
989 margin: 0 0 4px;
990 }
991 .p1-preview-price {
992 font-size: 13px;
993 text-align: center;
994 color: var(--wpsubs-text);
995 margin: 0 0 12px;
996 }
997 .p1-preview-price span {
998 color: var(--wpsubs-text-muted);
999 font-size: 12px;
1000 }
1001 .p1-preview-btn {
1002 display: block;
1003 width: 100%;
1004 box-sizing: border-box;
1005 background: var(--wpsubs-brand);
1006 color: var(--wpsubs-surface);
1007 text-align: center;
1008 padding: 9px 12px;
1009 border-radius: var(--wpsubs-radius-sm);
1010 font-size: 13px;
1011 font-weight: 600;
1012 border: none;
1013 cursor: default;
1014 white-space: nowrap;
1015 overflow: hidden;
1016 text-overflow: ellipsis;
1017 }
1018 .p1-preview-skeletons {
1019 margin-top: 10px;
1020 display: flex;
1021 flex-direction: column;
1022 gap: 6px;
1023 }
1024 .p1-preview-skeleton {
1025 height: 10px;
1026 border-radius: 4px;
1027 background: var(--wpsubs-border);
1028 }
1029 .p1-preview-skeleton:last-child {
1030 width: 65%;
1031 }
1032 .p1-starts-here {
1033 text-align: right;
1034 font-size: 11px;
1035 color: var(--wpsubs-brand);
1036 margin-top: 12px;
1037 font-style: italic;
1038 display: flex;
1039 align-items: center;
1040 justify-content: flex-end;
1041 gap: 4px;
1042 }
1043 @media (max-width: 680px) {
1044 #subscrpt-section-1 .wizard-card {
1045 grid-template-columns: 1fr;
1046 }
1047 .p1-right {
1048 display: none;
1049 }
1050 }
1051 </style>
1052
1053 <div class="wpsubs-tw-root wpsubs-layout" id="subscrpt-onboarding-wizard">
1054 <!-- Page 2+ only: stepper indicator -->
1055 <div class="wpsubs-wizard-stepper" id="subscrpt-stepper" style="display:none;">
1056 <div class="wpsubs-wizard-stepper__step active" data-step="1">
1057 <div class="wpsubs-wizard-stepper__num">1</div>
1058 <div class="wpsubs-wizard-stepper__label">Welcome</div>
1059 </div>
1060 <div class="wpsubs-wizard-stepper__line"></div>
1061 <div class="wpsubs-wizard-stepper__step" data-step="2">
1062 <div class="wpsubs-wizard-stepper__num">2</div>
1063 <div class="wpsubs-wizard-stepper__label">Product Setup</div>
1064 </div>
1065 <div class="wpsubs-wizard-stepper__line"></div>
1066 <div class="wpsubs-wizard-stepper__step" data-step="3">
1067 <div class="wpsubs-wizard-stepper__num">3</div>
1068 <div class="wpsubs-wizard-stepper__label"><?php esc_html_e( 'Done', 'subscription' ); ?></div>
1069 </div>
1070 </div>
1071
1072 <!-- Hidden state -->
1073 <input type="hidden" name="subscrpt_wizard_page" id="subscrpt-wizard-page" value="<?php echo esc_attr( $wizard_page ); ?>">
1074 <input type="hidden" name="subscrpt_product_id" id="subscrpt-product-id" value="<?php echo esc_attr( $product_id ); ?>">
1075 <input type="hidden" id="subscrpt-ajax-url" value="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>">
1076 <input type="hidden" id="subscrpt-subscriptions-url" value="<?php echo esc_url( admin_url( 'admin.php?page=wp-subscription' ) ); ?>">
1077 <?php wp_nonce_field( 'subscrpt_onboarding_wizard', 'subscrpt_wizard_nonce' ); ?>
1078
1079 <!-- =========================================== -->
1080 <!-- SECTION 1: Welcome -->
1081 <!-- =========================================== -->
1082 <div class="wizard-section <?php echo 1 === $wizard_page ? 'active' : ''; ?>" data-page="1" id="subscrpt-section-1">
1083 <div class="wizard-card">
1084 <!-- Left: content -->
1085 <div class="p1-left">
1086 <div class="p1-badge">
1087 <span class="p1-badge__dot"></span>
1088 <?php esc_html_e( 'Getting started', 'subscription' ); ?>
1089 </div>
1090 <h1 class="p1-heading">
1091 <?php esc_html_e( 'Your first subscription', 'subscription' ); ?>
1092 <span class="p1-heading__accent"><?php esc_html_e( 'starts here', 'subscription' ); ?></span>
1093 </h1>
1094 <p class="p1-desc"><?php esc_html_e( 'Set up your first subscription product in minutes. Start from scratch or convert a product you already sell.', 'subscription' ); ?></p>
1095 <ul class="p1-bullets">
1096 <li><span class="p1-bullet-dot"></span><?php esc_html_e( 'Daily, weekly, monthly, or annual billing', 'subscription' ); ?></li>
1097 <li><span class="p1-bullet-dot"></span><?php esc_html_e( 'Free trials and one-time sign-up fees', 'subscription' ); ?></li>
1098 </ul>
1099 <div class="p1-actions">
1100 <button type="button" id="subscrpt-btn-start" class="wpsubs-btn wpsubs-btn--primary">
1101 <?php esc_html_e( 'Create my first subscription', 'subscription' ); ?> &rsaquo;
1102 </button>
1103 <button type="button" id="subscrpt-btn-skip" class="p1-skip">
1104 <?php esc_html_e( 'Skip the intro', 'subscription' ); ?>
1105 </button>
1106 </div>
1107 </div>
1108 <!-- Right: product preview mockup -->
1109 <div class="p1-right" aria-hidden="true">
1110 <p class="p1-preview-label"><?php esc_html_e( 'Your shop', 'subscription' ); ?></p>
1111 <p class="p1-preview-sublabel"><?php esc_html_e( 'How customers see the product', 'subscription' ); ?></p>
1112 <div class="p1-preview-card">
1113 <div class="p1-preview-img">
1114 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1115 <path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path>
1116 <line x1="3" y1="6" x2="21" y2="6"></line>
1117 <path d="M16 10a4 4 0 0 1-8 0"></path>
1118 </svg>
1119 <div class="p1-preview-img__dots">
1120 <span></span><span></span><span></span>
1121 </div>
1122 </div>
1123 <div class="p1-preview-body">
1124 <p class="p1-preview-name"><?php esc_html_e( 'Monthly Subscription Box', 'subscription' ); ?></p>
1125 <p class="p1-preview-price">24.00$ <span>/ <?php esc_html_e( 'month', 'subscription' ); ?></span></p>
1126 <div class="p1-preview-btn"><?php esc_html_e( 'Sign up', 'subscription' ); ?></div>
1127 <div class="p1-preview-skeletons">
1128 <div class="p1-preview-skeleton"></div>
1129 <div class="p1-preview-skeleton"></div>
1130 </div>
1131 </div>
1132 </div>
1133 </div>
1134 </div>
1135 </div>
1136
1137 <!-- =========================================== -->
1138 <!-- SECTION 2: Product & Subscription Setup -->
1139 <!-- =========================================== -->
1140 <div class="wizard-section <?php echo 2 === $wizard_page ? 'active' : ''; ?>" id="subscrpt-section-2">
1141 <div class="wizard-card">
1142 <h1 class="p2-page-title"><?php esc_html_e( 'Create your subscription product', 'subscription' ); ?></h1>
1143 <p class="p2-page-subtitle"><?php esc_html_e( 'Set the basics now. Once published, customers can subscribe from your shop and you can fine-tune everything later in the product editor.', 'subscription' ); ?></p>
1144
1145 <!-- 1. Pick a starting point -->
1146 <div class="p2-section-block">
1147 <p class="p2-section-label"><?php esc_html_e( '1. Pick a starting point', 'subscription' ); ?></p>
1148 <p class="p2-section-desc"><?php esc_html_e( 'Build a fresh subscription product, or convert one you already sell.', 'subscription' ); ?></p>
1149
1150 <div class="p2-option-cards">
1151 <button type="button"
1152 class="p2-option-card product-toggle-btn <?php echo 'existing' !== ( isset( $session_data['product_mode'] ) ? $session_data['product_mode'] : 'new' ) ? 'active' : ''; ?>"
1153 id="subscrpt-btn-create-new" data-mode="new">
1154 <div class="p2-option-card__check">✓</div>
1155 <div class="p2-option-card__icon">
1156 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
1157 </div>
1158 <p class="p2-option-card__title"><?php esc_html_e( 'Create a new product', 'subscription' ); ?></p>
1159 <p class="p2-option-card__desc"><?php esc_html_e( 'Start with a blank subscription product.', 'subscription' ); ?></p>
1160 </button>
1161
1162 <?php if ( ! empty( $products ) ) : ?>
1163 <button type="button"
1164 class="p2-option-card product-toggle-btn <?php echo 'existing' === ( isset( $session_data['product_mode'] ) ? $session_data['product_mode'] : '' ) ? 'active' : ''; ?>"
1165 id="subscrpt-btn-use-existing" data-mode="existing">
1166 <div class="p2-option-card__check">✓</div>
1167 <div class="p2-option-card__icon">
1168 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/></svg>
1169 </div>
1170 <p class="p2-option-card__title"><?php esc_html_e( 'Use an existing product', 'subscription' ); ?></p>
1171 <p class="p2-option-card__desc"><?php esc_html_e( 'Convert a WooCommerce product into a subscription.', 'subscription' ); ?></p>
1172 </button>
1173 <?php endif; ?>
1174 </div>
1175
1176 <!-- Existing product selector -->
1177 <?php if ( ! empty( $products ) ) : ?>
1178 <div id="subscrpt-existing-product-fields" style="<?php echo 'existing' !== ( isset( $session_data['product_mode'] ) ? $session_data['product_mode'] : '' ) ? 'display:none;' : ''; ?>">
1179 <div id="subscrpt-product-select-wrap">
1180 <?php
1181 $avatar_palette = array(
1182 array(
1183 'bg' => '#fde8d8',
1184 'fg' => '#b85c20',
1185 ),
1186 array(
1187 'bg' => '#dbeafe',
1188 'fg' => '#1d4ed8',
1189 ),
1190 array(
1191 'bg' => '#ede9fe',
1192 'fg' => '#6d28d9',
1193 ),
1194 array(
1195 'bg' => '#d1fae5',
1196 'fg' => '#065f46',
1197 ),
1198 array(
1199 'bg' => '#fce7f3',
1200 'fg' => '#9d174d',
1201 ),
1202 array(
1203 'bg' => '#fef9c3',
1204 'fg' => '#854d0e',
1205 ),
1206 );
1207 ?>
1208 <div class="p2-product-search">
1209 <div class="p2-product-search__input-wrap">
1210 <svg class="p2-product-search__icon" width="15" height="15" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z"/></svg>
1211 <input type="text" class="p2-product-search__input wpsubs-input" id="subscrpt-product-search-input"
1212 placeholder="<?php esc_attr_e( 'Search WooCommerce products by name or SKU...', 'subscription' ); ?>"
1213 autocomplete="off">
1214 </div>
1215 <div class="p2-product-search__dropdown" id="subscrpt-product-search-dropdown" style="display:none;">
1216 <?php
1217 foreach ( $products as $i => $p ) :
1218 $wc_p = wc_get_product( $p->ID );
1219 $price = $wc_p ? $wc_p->get_price() : '';
1220 $type = $wc_p ? ucfirst( $wc_p->get_type() ) . ' ' . __( 'product', 'subscription' ) : '';
1221 $sku = $wc_p ? $wc_p->get_sku() : '';
1222 $billing_period_meta = $wc_p ? $wc_p->get_meta( '_subscrpt_timing_option' ) : '';
1223 $billing_per_meta = $wc_p ? $wc_p->get_meta( '_subscrpt_timing_per' ) : '';
1224 $trial_per_meta = $wc_p ? $wc_p->get_meta( '_subscrpt_trial_timing_per' ) : '';
1225 $signup_fee_meta = $wc_p ? $wc_p->get_meta( '_subscrpt_signup_fee' ) : '';
1226 $words = array_filter( explode( ' ', $p->post_title ) );
1227 $initials = implode(
1228 '',
1229 array_slice(
1230 array_map(
1231 function ( $w ) {
1232 return mb_strtoupper( mb_substr( $w, 0, 1 ) );
1233 },
1234 $words
1235 ),
1236 0,
1237 2
1238 )
1239 );
1240 $color = $avatar_palette[ $i % count( $avatar_palette ) ];
1241 ?>
1242 <?php $is_variable_locked = ( $wc_p && 'variable' === $wc_p->get_type() && ! $is_pro ); ?>
1243 <div class="p2-product-search__item<?php echo $is_variable_locked ? ' p2-product-search__item--locked' : ''; ?>"
1244 data-id="<?php echo esc_attr( $p->ID ); ?>"
1245 data-price="<?php echo esc_attr( $price ); ?>"
1246 data-type="<?php echo esc_attr( $type ); ?>"
1247 data-product-type="<?php echo esc_attr( $wc_p ? $wc_p->get_type() : '' ); ?>"
1248 data-sku="<?php echo esc_attr( $sku ); ?>"
1249 data-name="<?php echo esc_attr( $p->post_title ); ?>"
1250 data-billing-period="<?php echo esc_attr( $billing_period_meta ); ?>"
1251 data-billing-per="<?php echo esc_attr( $billing_per_meta ?: '1' ); ?>"
1252 data-trial-per="<?php echo esc_attr( $trial_per_meta ); ?>"
1253 data-signup-fee="<?php echo esc_attr( $signup_fee_meta ); ?>">
1254 <div class="p2-product-search__avatar" style="background:<?php echo esc_attr( $color['bg'] ); ?>;color:<?php echo esc_attr( $color['fg'] ); ?>">
1255 <?php echo esc_html( $initials ?: '?' ); ?>
1256 </div>
1257 <div class="p2-product-search__info">
1258 <p class="p2-product-search__name">
1259 <?php echo esc_html( $p->post_title ); ?>
1260 <?php if ( $is_variable_locked ) : ?>
1261 <span class="p2-pro-badge" title="<?php esc_attr_e( 'WPSubscription Pro required', 'subscription' ); ?>"><?php esc_html_e( 'Pro', 'subscription' ); ?></span>
1262 <?php endif; ?>
1263 </p>
1264 <p class="p2-product-search__meta"><?php echo esc_html( ( $sku ? 'SKU ' . $sku . ' · ' : '' ) . $type ); ?></p>
1265 </div>
1266 <?php if ( '' !== $price ) : ?>
1267 <span class="p2-product-search__price"><?php echo esc_html( get_woocommerce_currency_symbol() . number_format( (float) $price, 2 ) ); ?></span>
1268 <?php endif; ?>
1269 </div>
1270 <?php endforeach; ?>
1271 <div class="p2-product-search__empty" style="display:none;"><?php esc_html_e( 'No products found.', 'subscription' ); ?></div>
1272 </div>
1273 </div>
1274 <input type="hidden" name="subscrpt_existing_product" id="subscrpt-existing-product-hidden" value="<?php echo $product_id > 0 ? esc_attr( $product_id ) : ''; ?>">
1275 </div>
1276 <div id="subscrpt-selected-product-chip" class="p2-selected-product" style="display:none;">
1277 <div class="p2-selected-product__avatar" id="p2-chip-avatar"></div>
1278 <div class="p2-selected-product__info">
1279 <p class="p2-selected-product__name" id="p2-chip-name"></p>
1280 <p class="p2-selected-product__meta" id="p2-chip-meta"></p>
1281 </div>
1282 <button type="button" class="p2-selected-product__clear" id="subscrpt-btn-clear-product" aria-label="<?php esc_attr_e( 'Clear selection', 'subscription' ); ?>">×</button>
1283 </div>
1284 <!-- Variation picker (shown when a variable product is selected) -->
1285 <div id="subscrpt-variation-picker-wrap" class="p2-variation-picker" style="display:none;">
1286 <div id="subscrpt-variation-picker-list"></div>
1287 </div>
1288 <input type="hidden" name="subscrpt_variation_id" id="subscrpt-variation-id-hidden" value="">
1289 </div>
1290 <?php endif; ?>
1291 </div>
1292
1293 <!-- 2. Subscription details -->
1294 <div class="p2-section-block" style="margin-bottom:0;">
1295 <p class="p2-section-label"><?php esc_html_e( '2. Subscription details', 'subscription' ); ?></p>
1296 <p class="p2-section-desc"><?php esc_html_e( 'How and how often customers are billed once they subscribe.', 'subscription' ); ?></p>
1297
1298 <div class="p2-body">
1299 <!-- Left: form -->
1300 <div>
1301 <!-- Product name -->
1302 <div id="subscrpt-new-product-fields">
1303 <div class="form-row">
1304 <label for="subscrpt_product_name"><?php esc_html_e( 'Product name', 'subscription' ); ?></label>
1305 <input type="text" id="subscrpt_product_name" name="subscrpt_product_name" class="wpsubs-input" autocomplete="off" placeholder="<?php esc_attr_e( 'e.g. Monthly Subscription Box', 'subscription' ); ?>" value="<?php echo $product ? esc_attr( $product->get_name() ) : ( isset( $session_data['product_name'] ) ? esc_attr( $session_data['product_name'] ) : '' ); ?>">
1306 <p class="p2-field-hint"><?php esc_html_e( 'Shown on your store page and in subscription emails.', 'subscription' ); ?></p>
1307 </div>
1308 </div>
1309
1310 <?php
1311 $billing_period = isset( $session_data['billing_period'] ) ? $session_data['billing_period'] : 'months';
1312 $trial_period = isset( $session_data['trial_timing_option'] ) ? $session_data['trial_timing_option'] : 'days';
1313 $trial_period_options = array(
1314 array(
1315 'value' => 'days',
1316 'label' => __( 'Day', 'subscription' ),
1317 ),
1318 array(
1319 'value' => 'weeks',
1320 'label' => __( 'Week', 'subscription' ),
1321 ),
1322 array(
1323 'value' => 'months',
1324 'label' => __( 'Month', 'subscription' ),
1325 ),
1326 array(
1327 'value' => 'years',
1328 'label' => __( 'Year', 'subscription' ),
1329 ),
1330 );
1331 $period_options = array(
1332 array(
1333 'value' => 'days',
1334 'label' => __( 'Day', 'subscription' ),
1335 ),
1336 array(
1337 'value' => 'weeks',
1338 'label' => __( 'Week', 'subscription' ),
1339 ),
1340 array(
1341 'value' => 'months',
1342 'label' => __( 'Month', 'subscription' ),
1343 ),
1344 array(
1345 'value' => 'years',
1346 'label' => __( 'Year', 'subscription' ),
1347 ),
1348 );
1349 ?>
1350 <input type="hidden" id="subscrpt_timing_option" name="subscrpt_timing_option" value="never">
1351 <input type="hidden" id="subscrpt_billing_per" name="subscrpt_billing_per" value="<?php echo $is_pro && isset( $session_data['billing_per'] ) ? esc_attr( $session_data['billing_per'] ) : '1'; ?>">
1352
1353 <!-- Row: Price | Billing every (group component) -->
1354 <div class="p2-form-grid">
1355 <div class="form-row">
1356 <label for="subscrpt_product_price"><?php esc_html_e( 'Price', 'subscription' ); ?></label>
1357 <div class="p2-input-wrap">
1358 <span class="p2-input-prefix"><?php echo esc_html( get_woocommerce_currency_symbol() ); ?></span>
1359 <input type="text" id="subscrpt_product_price" name="subscrpt_product_price" class="wpsubs-input" autocomplete="off" style="padding-left:24px!important;" placeholder="0.00" value="<?php echo $product ? esc_attr( $product->get_price() ) : ( isset( $session_data['product_price'] ) ? esc_attr( $session_data['product_price'] ) : '' ); ?>">
1360 </div>
1361 </div>
1362 <div class="form-row">
1363 <label><?php esc_html_e( 'Billing every', 'subscription' ); ?></label>
1364 <div class="wpsubs-input-group p2-billing-group">
1365 <?php if ( $is_pro ) : ?>
1366 <input type="number" id="subscrpt_billing_per_visible" class="wpsubs-input p2-billing-per-input" autocomplete="off" min="1"
1367 value="<?php echo isset( $session_data['billing_per'] ) ? esc_attr( $session_data['billing_per'] ) : '1'; ?>"
1368 oninput="document.getElementById('subscrpt_billing_per').value=this.value">
1369 <?php endif; ?>
1370 <?php
1371 wpsubs_render_adv_select(
1372 array(
1373 'name' => 'subscrpt_billing_period',
1374 'id' => 'subscrpt-billing-period-select',
1375 'value' => $billing_period,
1376 'options' => $period_options,
1377 )
1378 );
1379 ?>
1380 </div>
1381 </div>
1382 </div>
1383
1384 <!-- Free trial (free) + Sign-up fee (Pro only) -->
1385 <div class="p2-form-grid">
1386 <div class="form-row">
1387 <label for="subscrpt_trial_timing_per"><?php esc_html_e( 'Free trial', 'subscription' ); ?> <span class="p2-label-optional"><?php esc_html_e( 'Optional', 'subscription' ); ?></span></label>
1388 <div class="wpsubs-input-group p2-billing-group">
1389 <input type="number" id="subscrpt_trial_timing_per" name="subscrpt_trial_timing_per" class="wpsubs-input p2-billing-per-input" autocomplete="off" min="0" value="<?php echo isset( $session_data['trial_timing_per'] ) ? esc_attr( $session_data['trial_timing_per'] ) : '0'; ?>">
1390 <?php
1391 wpsubs_render_adv_select(
1392 array(
1393 'name' => 'subscrpt_trial_timing_option',
1394 'id' => 'subscrpt-trial-period-select',
1395 'value' => $trial_period,
1396 'options' => $trial_period_options,
1397 )
1398 );
1399 ?>
1400 </div>
1401 <p class="p2-field-hint"><?php esc_html_e( 'Free period before the first charge. Leave 0 for none.', 'subscription' ); ?></p>
1402 </div>
1403 <div class="form-row <?php echo $is_pro ? '' : 'p2-field-pro-locked'; ?>">
1404 <label for="subscrpt_signup_fee">
1405 <?php esc_html_e( 'Sign-up fee', 'subscription' ); ?>
1406 <?php if ( ! $is_pro ) : ?>
1407 <span class="p2-pro-badge" title="<?php esc_attr_e( 'WPSubscription Pro required', 'subscription' ); ?>"><?php esc_html_e( 'Pro', 'subscription' ); ?></span>
1408 <?php else : ?>
1409 <span class="p2-label-optional"><?php esc_html_e( 'Optional', 'subscription' ); ?></span>
1410 <?php endif; ?>
1411 </label>
1412 <div class="p2-input-wrap">
1413 <span class="p2-input-prefix"><?php echo esc_html( get_woocommerce_currency_symbol() ); ?></span>
1414 <input type="text" id="subscrpt_signup_fee" name="subscrpt_signup_fee" class="wpsubs-input" autocomplete="off" style="padding-left:24px!important;" placeholder="0.00"
1415 value="<?php echo $is_pro && isset( $session_data['signup_fee'] ) ? esc_attr( $session_data['signup_fee'] ) : ''; ?>"
1416 <?php echo $is_pro ? '' : 'disabled'; ?>>
1417 </div>
1418 <?php if ( ! $is_pro ) : ?>
1419 <p class="p2-field-hint"><?php esc_html_e( 'One-time charge at checkout. Upgrade to Pro to enable.', 'subscription' ); ?></p>
1420 <?php else : ?>
1421 <p class="p2-field-hint"><?php esc_html_e( 'One-time charge at checkout.', 'subscription' ); ?></p>
1422 <?php endif; ?>
1423 </div>
1424 </div>
1425
1426 <!-- Hidden compat fields -->
1427 <input type="hidden" id="subscrpt_trial_enabled" name="subscrpt_trial_enabled" value="0">
1428 <input type="hidden" id="subscrpt_length_enabled" name="subscrpt_length_enabled" value="0">
1429 <input type="hidden" id="subscrpt_length_per" name="subscrpt_length_per" value="">
1430 <input type="hidden" id="subscrpt_length_option" name="subscrpt_length_option" value="months">
1431 </div>
1432
1433 <!-- Right: shop preview -->
1434 <div class="p2-preview-col">
1435 <p class="p2-preview-col-label"><?php esc_html_e( 'Shop Preview', 'subscription' ); ?></p>
1436 <div class="p1-preview-card">
1437 <div class="p1-preview-img">
1438 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1439 <path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path>
1440 <line x1="3" y1="6" x2="21" y2="6"></line>
1441 <path d="M16 10a4 4 0 0 1-8 0"></path>
1442 </svg>
1443 <div class="p1-preview-img__dots"><span></span><span></span><span></span></div>
1444 </div>
1445 <div class="p1-preview-body">
1446 <p class="p1-preview-name" id="p2-preview-name"><?php echo $product ? esc_html( $product->get_name() ) : esc_html__( 'Your product', 'subscription' ); ?></p>
1447 <p class="p1-preview-price"><span id="p2-preview-price"><?php echo $product ? esc_html( $product->get_price() ) : '0.00'; ?></span>$ <span>/ <span id="p2-preview-period"><?php echo isset( $session_data['billing_period'] ) ? esc_html( $session_data['billing_period'] ) : esc_html__( 'month', 'subscription' ); ?></span></span></p>
1448 <div class="p1-preview-btn"><?php esc_html_e( 'Sign up', 'subscription' ); ?></div>
1449 </div>
1450 </div>
1451 <p class="p2-preview-col-desc"><?php esc_html_e( 'This is how the product will appear on your shop page. Each purchase creates a subscription you\'ll manage from the Subscriptions list.', 'subscription' ); ?></p>
1452 </div>
1453 </div>
1454 </div>
1455 </div>
1456
1457 <!-- Nav outside card -->
1458 <div class="p2-nav">
1459 <button type="button" id="subscrpt-btn-back" class="p2-nav-back">
1460 &#8249; <?php esc_html_e( 'Back', 'subscription' ); ?>
1461 </button>
1462 <button type="button" id="subscrpt-btn-save" class="wpsubs-btn wpsubs-btn--primary">
1463 <?php esc_html_e( 'Create product', 'subscription' ); ?> &rsaquo;
1464 </button>
1465 </div>
1466 </div>
1467
1468 <!-- =========================================== -->
1469 <!-- SECTION 3: Completion -->
1470 <!-- =========================================== -->
1471 <div class="wizard-section <?php echo 3 === $wizard_page ? 'active' : ''; ?>" id="subscrpt-section-3">
1472 <div class="wizard-card p3-card">
1473
1474 <!-- Success icon -->
1475 <div class="p3-success-icon">
1476 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1477 <polyline points="20 6 9 17 4 12"></polyline>
1478 </svg>
1479 </div>
1480
1481 <h1 class="p3-heading"><?php esc_html_e( 'Your product is live.', 'subscription' ); ?></h1>
1482 <p class="p3-subtext"><?php esc_html_e( "It's published to your shop now. When a customer buys it, a subscription is created automatically. You'll see those in the Subscriptions list.", 'subscription' ); ?></p>
1483
1484 <?php
1485 if ( $product ) :
1486 $p3_price = $product->get_price();
1487 $p3_period_raw = isset( $session_data['billing_period'] ) ? $session_data['billing_period'] : 'months';
1488 $p3_billing_per = isset( $session_data['billing_per'] ) ? (int) $session_data['billing_per'] : 1;
1489 $p3_period_label = $p3_billing_per > 1
1490 ? $p3_billing_per . ' ' . strtolower( $p3_period_raw )
1491 : strtolower( subscrpt_get_typos( 1, $p3_period_raw ) );
1492 $p3_words = array_filter( explode( ' ', $product->get_name() ) );
1493 $p3_initials = implode(
1494 '',
1495 array_map(
1496 function ( $w ) {
1497 return strtoupper( mb_substr( $w, 0, 1 ) );
1498 },
1499 array_slice( $p3_words, 0, 2 )
1500 )
1501 );
1502 ?>
1503 <!-- Product card -->
1504 <div class="p3-product-card">
1505 <div class="p3-product-card__header">
1506 <span><?php esc_html_e( 'PRODUCT', 'subscription' ); ?></span>
1507 <span><?php esc_html_e( 'STATUS', 'subscription' ); ?></span>
1508 <span><?php esc_html_e( 'PRICE', 'subscription' ); ?></span>
1509 </div>
1510 <div class="p3-product-card__row">
1511 <div class="p3-product-card__product">
1512 <div class="p3-product-avatar"><?php echo esc_html( $p3_initials ); ?></div>
1513 <div>
1514 <p class="p3-product-name"><?php echo esc_html( $product->get_name() ); ?></p>
1515 <p class="p3-product-meta">
1516 <?php
1517 /* translators: %d: product ID */
1518 echo esc_html( sprintf( __( 'Product #%d', 'subscription' ), $product->get_id() ) );
1519 ?>
1520 &middot; <?php esc_html_e( 'Subscription', 'subscription' ); ?>
1521 </p>
1522 </div>
1523 </div>
1524 <div class="p3-product-card__status">
1525 <span class="p3-status-badge">
1526 <span class="p3-status-badge__dot"></span>
1527 <?php esc_html_e( 'Published', 'subscription' ); ?>
1528 </span>
1529 <p class="p3-status-sub"><?php esc_html_e( 'Live in your shop', 'subscription' ); ?></p>
1530 </div>
1531 <div class="p3-product-card__price">
1532 <span class="p3-price-amount"><?php echo wp_kses_post( wc_price( $p3_price ) ); ?></span>
1533 <span class="p3-price-period">/ <?php echo esc_html( $p3_period_label ); ?></span>
1534 </div>
1535 </div>
1536 </div>
1537 <?php endif; ?>
1538
1539 <!-- What now -->
1540 <p class="p3-what-now-label"><?php esc_html_e( 'WHAT NOW?', 'subscription' ); ?></p>
1541
1542 <div class="p3-action-rows">
1543 <?php if ( $product ) : ?>
1544 <a href="<?php echo esc_url( get_permalink( $product->get_id() ) ); ?>" target="_blank" rel="noopener" class="p3-action-row">
1545 <div class="p3-action-row__icon">
1546 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path><line x1="3" y1="6" x2="21" y2="6"></line><path d="M16 10a4 4 0 0 1-8 0"></path></svg>
1547 </div>
1548 <div class="p3-action-row__content">
1549 <p class="p3-action-row__title"><?php esc_html_e( 'View product in shop', 'subscription' ); ?></p>
1550 <p class="p3-action-row__desc"><?php esc_html_e( 'See how customers will subscribe to it.', 'subscription' ); ?></p>
1551 </div>
1552 <svg class="p3-action-row__chevron" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
1553 </a>
1554 <?php endif; ?>
1555
1556 <button type="button" id="subscrpt-btn-add-another" class="p3-action-row">
1557 <div class="p3-action-row__icon">
1558 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
1559 </div>
1560 <div class="p3-action-row__content">
1561 <p class="p3-action-row__title"><?php esc_html_e( 'Add another product', 'subscription' ); ?></p>
1562 <p class="p3-action-row__desc"><?php esc_html_e( 'Create another subscription product now.', 'subscription' ); ?></p>
1563 </div>
1564 <svg class="p3-action-row__chevron" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
1565 </button>
1566
1567 </div>
1568
1569 <p class="p3-help-text">
1570 <?php esc_html_e( 'Need help? Check the', 'subscription' ); ?>
1571 <a href="https://docs.converslabs.com/en" target="_blank" rel="noopener" class="p3-help-link"><?php esc_html_e( 'setup guide', 'subscription' ); ?></a>
1572 <?php esc_html_e( 'or', 'subscription' ); ?>
1573 <a href="https://wordpress.org/support/plugin/subscription/" target="_blank" rel="noopener" class="p3-help-link"><?php esc_html_e( 'contact support', 'subscription' ); ?></a>.
1574 </p>
1575 </div>
1576
1577 <!-- Bottom nav -->
1578 <div class="p3-nav">
1579 <button type="button" id="subscrpt-btn-start-over" class="wpsubs-btn wpsubs-btn--outline">
1580 <?php esc_html_e( 'Start over', 'subscription' ); ?>
1581 </button>
1582 <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=product' ) ); ?>" class="wpsubs-btn wpsubs-btn--primary">
1583 <?php esc_html_e( 'Go to products', 'subscription' ); ?>
1584 </a>
1585 </div>
1586 </div>
1587 </div>
1588