PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 1.11.2
Subscriptions for WooCommerce with Stripe Recurring Payments v1.11.2
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.11.2, at includes/Admin/views/onboarding-wizard.php

571 lines 29.9 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 <div class="wpsubs-layout" id="subscrpt-onboarding-wizard">
37 <!-- Page 2+ only: stepper indicator -->
38 <div class="wpsubs-wizard-stepper" id="subscrpt-stepper" style="display:none;">
39 <div class="wpsubs-wizard-stepper__step active" data-step="1">
40 <div class="wpsubs-wizard-stepper__num">1</div>
41 <div class="wpsubs-wizard-stepper__label">Welcome</div>
42 </div>
43 <div class="wpsubs-wizard-stepper__line"></div>
44 <div class="wpsubs-wizard-stepper__step" data-step="2">
45 <div class="wpsubs-wizard-stepper__num">2</div>
46 <div class="wpsubs-wizard-stepper__label">Product Setup</div>
47 </div>
48 <div class="wpsubs-wizard-stepper__line"></div>
49 <div class="wpsubs-wizard-stepper__step" data-step="3">
50 <div class="wpsubs-wizard-stepper__num">3</div>
51 <div class="wpsubs-wizard-stepper__label"><?php esc_html_e( 'Done', 'subscription' ); ?></div>
52 </div>
53 </div>
54
55 <!-- Hidden state -->
56 <input type="hidden" name="subscrpt_wizard_page" id="subscrpt-wizard-page" value="<?php echo esc_attr( $wizard_page ); ?>">
57 <input type="hidden" name="subscrpt_product_id" id="subscrpt-product-id" value="<?php echo esc_attr( $product_id ); ?>">
58 <input type="hidden" id="subscrpt-ajax-url" value="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>">
59 <input type="hidden" id="subscrpt-subscriptions-url" value="<?php echo esc_url( admin_url( 'admin.php?page=wp-subscription' ) ); ?>">
60 <?php wp_nonce_field( 'subscrpt_onboarding_wizard', 'subscrpt_wizard_nonce' ); ?>
61
62 <!-- =========================================== -->
63 <!-- SECTION 1: Welcome -->
64 <!-- =========================================== -->
65 <div class="wpsubs-wizard-section <?php echo 1 === $wizard_page ? 'active' : ''; ?>" data-page="1" id="subscrpt-section-1">
66 <div class="wpsubs-wizard-card">
67 <!-- Left: content -->
68 <div class="wpsubs-p1-left">
69 <div class="wpsubs-p1-badge">
70 <span class="wpsubs-p1-badge__dot"></span>
71 <?php esc_html_e( 'Getting started', 'subscription' ); ?>
72 </div>
73 <h1 class="wpsubs-p1-heading">
74 <?php esc_html_e( 'Your first subscription', 'subscription' ); ?>
75 <span class="wpsubs-p1-heading__accent"><?php esc_html_e( 'starts here', 'subscription' ); ?></span>
76 </h1>
77 <p class="wpsubs-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>
78 <ul class="wpsubs-p1-bullets">
79 <li><span class="wpsubs-p1-bullet-dot"></span><?php esc_html_e( 'Daily, weekly, monthly, or annual billing', 'subscription' ); ?></li>
80 <li><span class="wpsubs-p1-bullet-dot"></span><?php esc_html_e( 'Free trials and one-time sign-up fees', 'subscription' ); ?></li>
81 </ul>
82 <div class="wpsubs-p1-actions">
83 <button type="button" id="subscrpt-btn-start" class="wpsubs-btn wpsubs-btn--primary">
84 <?php esc_html_e( 'Create my first subscription', 'subscription' ); ?> &rsaquo;
85 </button>
86 <button type="button" id="subscrpt-btn-skip" class="wpsubs-p1-skip">
87 <?php esc_html_e( 'Skip the intro', 'subscription' ); ?>
88 </button>
89 </div>
90 </div>
91 <!-- Right: product preview mockup -->
92 <div class="wpsubs-p1-right" aria-hidden="true">
93 <p class="wpsubs-p1-preview-label"><?php esc_html_e( 'Your shop', 'subscription' ); ?></p>
94 <p class="wpsubs-p1-preview-sublabel"><?php esc_html_e( 'How customers see the product', 'subscription' ); ?></p>
95 <div class="wpsubs-p1-preview-card">
96 <div class="wpsubs-p1-preview-img">
97 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
98 <path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path>
99 <line x1="3" y1="6" x2="21" y2="6"></line>
100 <path d="M16 10a4 4 0 0 1-8 0"></path>
101 </svg>
102 <div class="wpsubs-p1-preview-img__dots">
103 <span></span><span></span><span></span>
104 </div>
105 </div>
106 <div class="wpsubs-p1-preview-body">
107 <p class="wpsubs-p1-preview-name"><?php esc_html_e( 'Monthly Subscription Box', 'subscription' ); ?></p>
108 <p class="wpsubs-p1-preview-price">24.00$ <span>/ <?php esc_html_e( 'month', 'subscription' ); ?></span></p>
109 <div class="wpsubs-p1-preview-btn"><?php esc_html_e( 'Sign up', 'subscription' ); ?></div>
110 <div class="wpsubs-p1-preview-skeletons">
111 <div class="wpsubs-p1-preview-skeleton"></div>
112 <div class="wpsubs-p1-preview-skeleton"></div>
113 </div>
114 </div>
115 </div>
116 </div>
117 </div>
118 </div>
119
120 <!-- =========================================== -->
121 <!-- SECTION 2: Product & Subscription Setup -->
122 <!-- =========================================== -->
123 <div class="wpsubs-wizard-section <?php echo 2 === $wizard_page ? 'active' : ''; ?>" id="subscrpt-section-2">
124 <div class="wpsubs-wizard-card">
125 <h1 class="wpsubs-p2-page-title"><?php esc_html_e( 'Create your subscription product', 'subscription' ); ?></h1>
126 <p class="wpsubs-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>
127
128 <!-- 1. Pick a starting point -->
129 <div class="wpsubs-p2-section-block">
130 <p class="wpsubs-p2-section-label"><?php esc_html_e( '1. Pick a starting point', 'subscription' ); ?></p>
131 <p class="wpsubs-p2-section-desc"><?php esc_html_e( 'Build a fresh subscription product, or convert one you already sell.', 'subscription' ); ?></p>
132
133 <div class="wpsubs-p2-option-cards">
134 <button type="button"
135 class="wpsubs-p2-option-card product-toggle-btn <?php echo 'existing' !== ( isset( $session_data['product_mode'] ) ? $session_data['product_mode'] : 'new' ) ? 'active' : ''; ?>"
136 id="subscrpt-btn-create-new" data-mode="new">
137 <div class="wpsubs-p2-option-card__check">✓</div>
138 <div class="wpsubs-p2-option-card__icon">
139 <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>
140 </div>
141 <p class="wpsubs-p2-option-card__title"><?php esc_html_e( 'Create a new product', 'subscription' ); ?></p>
142 <p class="wpsubs-p2-option-card__desc"><?php esc_html_e( 'Start with a blank subscription product.', 'subscription' ); ?></p>
143 </button>
144
145 <?php if ( ! empty( $products ) ) : ?>
146 <button type="button"
147 class="wpsubs-p2-option-card product-toggle-btn <?php echo 'existing' === ( isset( $session_data['product_mode'] ) ? $session_data['product_mode'] : '' ) ? 'active' : ''; ?>"
148 id="subscrpt-btn-use-existing" data-mode="existing">
149 <div class="wpsubs-p2-option-card__check">✓</div>
150 <div class="wpsubs-p2-option-card__icon">
151 <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>
152 </div>
153 <p class="wpsubs-p2-option-card__title"><?php esc_html_e( 'Use an existing product', 'subscription' ); ?></p>
154 <p class="wpsubs-p2-option-card__desc"><?php esc_html_e( 'Convert a WooCommerce product into a subscription.', 'subscription' ); ?></p>
155 </button>
156 <?php endif; ?>
157 </div>
158
159 <!-- Existing product selector -->
160 <?php if ( ! empty( $products ) ) : ?>
161 <div id="subscrpt-existing-product-fields" style="<?php echo 'existing' !== ( isset( $session_data['product_mode'] ) ? $session_data['product_mode'] : '' ) ? 'display:none;' : ''; ?>">
162 <div id="subscrpt-product-select-wrap">
163 <?php
164 $avatar_palette = array(
165 array(
166 'bg' => '#fde8d8',
167 'fg' => '#b85c20',
168 ),
169 array(
170 'bg' => '#dbeafe',
171 'fg' => '#1d4ed8',
172 ),
173 array(
174 'bg' => '#ede9fe',
175 'fg' => '#6d28d9',
176 ),
177 array(
178 'bg' => '#d1fae5',
179 'fg' => '#065f46',
180 ),
181 array(
182 'bg' => '#fce7f3',
183 'fg' => '#9d174d',
184 ),
185 array(
186 'bg' => '#fef9c3',
187 'fg' => '#854d0e',
188 ),
189 );
190 ?>
191 <div class="wpsubs-p2-product-search">
192 <div class="wpsubs-p2-product-search__input-wrap">
193 <svg class="wpsubs-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>
194 <input type="text" class="wpsubs-p2-product-search__input wpsubs-input" id="subscrpt-product-search-input"
195 placeholder="<?php esc_attr_e( 'Search WooCommerce products by name or SKU...', 'subscription' ); ?>"
196 autocomplete="off">
197 </div>
198 <div class="wpsubs-p2-product-search__dropdown" id="subscrpt-product-search-dropdown" style="display:none;">
199 <?php
200 foreach ( $products as $i => $p ) :
201 $wc_p = wc_get_product( $p->ID );
202 $price = $wc_p ? $wc_p->get_price() : '';
203 $type = $wc_p ? ucfirst( $wc_p->get_type() ) . ' ' . __( 'product', 'subscription' ) : '';
204 $sku = $wc_p ? $wc_p->get_sku() : '';
205 $billing_period_meta = $wc_p ? $wc_p->get_meta( '_subscrpt_timing_option' ) : '';
206 $billing_per_meta = $wc_p ? $wc_p->get_meta( '_subscrpt_timing_per' ) : '';
207 $trial_per_meta = $wc_p ? $wc_p->get_meta( '_subscrpt_trial_timing_per' ) : '';
208 $signup_fee_meta = $wc_p ? $wc_p->get_meta( '_subscrpt_signup_fee' ) : '';
209 $words = array_filter( explode( ' ', $p->post_title ) );
210 $initials = implode(
211 '',
212 array_slice(
213 array_map(
214 function ( $w ) {
215 return mb_strtoupper( mb_substr( $w, 0, 1 ) );
216 },
217 $words
218 ),
219 0,
220 2
221 )
222 );
223 $color = $avatar_palette[ $i % count( $avatar_palette ) ];
224 ?>
225 <?php $is_variable_locked = ( $wc_p && 'variable' === $wc_p->get_type() && ! $is_pro ); ?>
226 <div class="wpsubs-p2-product-search__item<?php echo $is_variable_locked ? ' wpsubs-p2-product-search__item--locked' : ''; ?>"
227 data-id="<?php echo esc_attr( $p->ID ); ?>"
228 data-price="<?php echo esc_attr( $price ); ?>"
229 data-type="<?php echo esc_attr( $type ); ?>"
230 data-product-type="<?php echo esc_attr( $wc_p ? $wc_p->get_type() : '' ); ?>"
231 data-sku="<?php echo esc_attr( $sku ); ?>"
232 data-name="<?php echo esc_attr( $p->post_title ); ?>"
233 data-billing-period="<?php echo esc_attr( $billing_period_meta ); ?>"
234 data-billing-per="<?php echo esc_attr( $billing_per_meta ?: '1' ); ?>"
235 data-trial-per="<?php echo esc_attr( $trial_per_meta ); ?>"
236 data-signup-fee="<?php echo esc_attr( $signup_fee_meta ); ?>">
237 <div class="wpsubs-p2-product-search__avatar" style="background:<?php echo esc_attr( $color['bg'] ); ?>;color:<?php echo esc_attr( $color['fg'] ); ?>">
238 <?php echo esc_html( $initials ?: '?' ); ?>
239 </div>
240 <div class="wpsubs-p2-product-search__info">
241 <p class="wpsubs-p2-product-search__name">
242 <?php echo esc_html( $p->post_title ); ?>
243 <?php if ( $is_variable_locked ) : ?>
244 <span class="wpsubs-p2-pro-badge" title="<?php esc_attr_e( 'WPSubscription Pro required', 'subscription' ); ?>"><?php esc_html_e( 'Pro', 'subscription' ); ?></span>
245 <?php endif; ?>
246 </p>
247 <p class="wpsubs-p2-product-search__meta"><?php echo esc_html( ( $sku ? 'SKU ' . $sku . ' · ' : '' ) . $type ); ?></p>
248 </div>
249 <?php if ( '' !== $price ) : ?>
250 <span class="wpsubs-p2-product-search__price"><?php echo esc_html( get_woocommerce_currency_symbol() . number_format( (float) $price, 2 ) ); ?></span>
251 <?php endif; ?>
252 </div>
253 <?php endforeach; ?>
254 <div class="wpsubs-p2-product-search__empty" style="display:none;"><?php esc_html_e( 'No products found.', 'subscription' ); ?></div>
255 </div>
256 </div>
257 <input type="hidden" name="subscrpt_existing_product" id="subscrpt-existing-product-hidden" value="<?php echo $product_id > 0 ? esc_attr( $product_id ) : ''; ?>">
258 </div>
259 <div id="subscrpt-selected-product-chip" class="wpsubs-p2-selected-product" style="display:none;">
260 <div class="wpsubs-p2-selected-product__avatar" id="p2-chip-avatar"></div>
261 <div class="wpsubs-p2-selected-product__info">
262 <p class="wpsubs-p2-selected-product__name" id="p2-chip-name"></p>
263 <p class="wpsubs-p2-selected-product__meta" id="p2-chip-meta"></p>
264 </div>
265 <button type="button" class="wpsubs-p2-selected-product__clear" id="subscrpt-btn-clear-product" aria-label="<?php esc_attr_e( 'Clear selection', 'subscription' ); ?>">×</button>
266 </div>
267 <!-- Variation picker (shown when a variable product is selected) -->
268 <div id="subscrpt-variation-picker-wrap" class="wpsubs-p2-variation-picker" style="display:none;">
269 <div id="subscrpt-variation-picker-list"></div>
270 </div>
271 <input type="hidden" name="subscrpt_variation_id" id="subscrpt-variation-id-hidden" value="">
272 </div>
273 <?php endif; ?>
274 </div>
275
276 <!-- 2. Subscription details -->
277 <div class="wpsubs-p2-section-block" style="margin-bottom:0;">
278 <p class="wpsubs-p2-section-label"><?php esc_html_e( '2. Subscription details', 'subscription' ); ?></p>
279 <p class="wpsubs-p2-section-desc"><?php esc_html_e( 'How and how often customers are billed once they subscribe.', 'subscription' ); ?></p>
280
281 <div class="wpsubs-p2-body">
282 <!-- Left: form -->
283 <div>
284 <!-- Product name -->
285 <div id="subscrpt-new-product-fields">
286 <div class="wpsubs-form-row">
287 <label for="subscrpt_product_name"><?php esc_html_e( 'Product name', 'subscription' ); ?></label>
288 <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'] ) : '' ); ?>">
289 <p class="wpsubs-p2-field-hint"><?php esc_html_e( 'Shown on your store page and in subscription emails.', 'subscription' ); ?></p>
290 </div>
291 </div>
292
293 <?php
294 $billing_period = isset( $session_data['billing_period'] ) ? $session_data['billing_period'] : 'months';
295 $trial_period = isset( $session_data['trial_timing_option'] ) ? $session_data['trial_timing_option'] : 'days';
296 $trial_period_options = array(
297 array(
298 'value' => 'days',
299 'label' => __( 'Day', 'subscription' ),
300 ),
301 array(
302 'value' => 'weeks',
303 'label' => __( 'Week', 'subscription' ),
304 ),
305 array(
306 'value' => 'months',
307 'label' => __( 'Month', 'subscription' ),
308 ),
309 array(
310 'value' => 'years',
311 'label' => __( 'Year', 'subscription' ),
312 ),
313 );
314 $period_options = array(
315 array(
316 'value' => 'days',
317 'label' => __( 'Day', 'subscription' ),
318 ),
319 array(
320 'value' => 'weeks',
321 'label' => __( 'Week', 'subscription' ),
322 ),
323 array(
324 'value' => 'months',
325 'label' => __( 'Month', 'subscription' ),
326 ),
327 array(
328 'value' => 'years',
329 'label' => __( 'Year', 'subscription' ),
330 ),
331 );
332 ?>
333 <input type="hidden" id="subscrpt_timing_option" name="subscrpt_timing_option" value="never">
334 <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'; ?>">
335
336 <!-- Row: Price | Billing every (group component) -->
337 <div class="wpsubs-p2-form-grid">
338 <div class="wpsubs-form-row">
339 <label for="subscrpt_product_price"><?php esc_html_e( 'Price', 'subscription' ); ?></label>
340 <div class="wpsubs-p2-input-wrap">
341 <span class="wpsubs-p2-input-prefix"><?php echo esc_html( get_woocommerce_currency_symbol() ); ?></span>
342 <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'] ) : '' ); ?>">
343 </div>
344 </div>
345 <div class="wpsubs-form-row">
346 <label><?php esc_html_e( 'Billing every', 'subscription' ); ?></label>
347 <div class="wpsubs-input-group wpsubs-p2-billing-group">
348 <?php if ( $is_pro ) : ?>
349 <input type="number" id="subscrpt_billing_per_visible" class="wpsubs-input wpsubs-p2-billing-per-input" autocomplete="off" min="1"
350 value="<?php echo isset( $session_data['billing_per'] ) ? esc_attr( $session_data['billing_per'] ) : '1'; ?>"
351 oninput="document.getElementById('subscrpt_billing_per').value=this.value">
352 <?php endif; ?>
353 <?php
354 wpsubs_render_adv_select(
355 array(
356 'name' => 'subscrpt_billing_period',
357 'id' => 'subscrpt-billing-period-select',
358 'value' => $billing_period,
359 'options' => $period_options,
360 )
361 );
362 ?>
363 </div>
364 </div>
365 </div>
366
367 <!-- Free trial (free) + Sign-up fee (Pro only) -->
368 <div class="wpsubs-p2-form-grid">
369 <div class="wpsubs-form-row">
370 <label for="subscrpt_trial_timing_per"><?php esc_html_e( 'Free trial', 'subscription' ); ?> <span class="wpsubs-p2-label-optional"><?php esc_html_e( 'Optional', 'subscription' ); ?></span></label>
371 <div class="wpsubs-input-group wpsubs-p2-billing-group">
372 <input type="number" id="subscrpt_trial_timing_per" name="subscrpt_trial_timing_per" class="wpsubs-input wpsubs-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'; ?>">
373 <?php
374 wpsubs_render_adv_select(
375 array(
376 'name' => 'subscrpt_trial_timing_option',
377 'id' => 'subscrpt-trial-period-select',
378 'value' => $trial_period,
379 'options' => $trial_period_options,
380 )
381 );
382 ?>
383 </div>
384 <p class="wpsubs-p2-field-hint"><?php esc_html_e( 'Free period before the first charge. Leave 0 for none.', 'subscription' ); ?></p>
385 </div>
386 <div class="wpsubs-form-row <?php echo $is_pro ? '' : 'wpsubs-p2-field-pro-locked'; ?>">
387 <label for="subscrpt_signup_fee">
388 <?php esc_html_e( 'Sign-up fee', 'subscription' ); ?>
389 <?php if ( ! $is_pro ) : ?>
390 <span class="wpsubs-p2-pro-badge" title="<?php esc_attr_e( 'WPSubscription Pro required', 'subscription' ); ?>"><?php esc_html_e( 'Pro', 'subscription' ); ?></span>
391 <?php else : ?>
392 <span class="wpsubs-p2-label-optional"><?php esc_html_e( 'Optional', 'subscription' ); ?></span>
393 <?php endif; ?>
394 </label>
395 <div class="wpsubs-p2-input-wrap">
396 <span class="wpsubs-p2-input-prefix"><?php echo esc_html( get_woocommerce_currency_symbol() ); ?></span>
397 <input type="text" id="subscrpt_signup_fee" name="subscrpt_signup_fee" class="wpsubs-input" autocomplete="off" style="padding-left:24px!important;" placeholder="0.00"
398 value="<?php echo $is_pro && isset( $session_data['signup_fee'] ) ? esc_attr( $session_data['signup_fee'] ) : ''; ?>"
399 <?php echo $is_pro ? '' : 'disabled'; ?>>
400 </div>
401 <?php if ( ! $is_pro ) : ?>
402 <p class="wpsubs-p2-field-hint"><?php esc_html_e( 'One-time charge at checkout. Upgrade to Pro to enable.', 'subscription' ); ?></p>
403 <?php else : ?>
404 <p class="wpsubs-p2-field-hint"><?php esc_html_e( 'One-time charge at checkout.', 'subscription' ); ?></p>
405 <?php endif; ?>
406 </div>
407 </div>
408
409 <!-- Hidden compat fields -->
410 <input type="hidden" id="subscrpt_trial_enabled" name="subscrpt_trial_enabled" value="0">
411 <input type="hidden" id="subscrpt_length_enabled" name="subscrpt_length_enabled" value="0">
412 <input type="hidden" id="subscrpt_length_per" name="subscrpt_length_per" value="">
413 <input type="hidden" id="subscrpt_length_option" name="subscrpt_length_option" value="months">
414 </div>
415
416 <!-- Right: shop preview -->
417 <div class="wpsubs-p2-preview-col">
418 <p class="wpsubs-p2-preview-col-label"><?php esc_html_e( 'Shop Preview', 'subscription' ); ?></p>
419 <div class="wpsubs-p1-preview-card">
420 <div class="wpsubs-p1-preview-img">
421 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
422 <path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path>
423 <line x1="3" y1="6" x2="21" y2="6"></line>
424 <path d="M16 10a4 4 0 0 1-8 0"></path>
425 </svg>
426 <div class="wpsubs-p1-preview-img__dots"><span></span><span></span><span></span></div>
427 </div>
428 <div class="wpsubs-p1-preview-body">
429 <p class="wpsubs-p1-preview-name" id="p2-preview-name"><?php echo $product ? esc_html( $product->get_name() ) : esc_html__( 'Your product', 'subscription' ); ?></p>
430 <p class="wpsubs-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>
431 <div class="wpsubs-p1-preview-btn"><?php esc_html_e( 'Sign up', 'subscription' ); ?></div>
432 </div>
433 </div>
434 <p class="wpsubs-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>
435 </div>
436 </div>
437 </div>
438 </div>
439
440 <!-- Nav outside card -->
441 <div class="wpsubs-p2-nav">
442 <button type="button" id="subscrpt-btn-back" class="wpsubs-p2-nav-back">
443 &#8249; <?php esc_html_e( 'Back', 'subscription' ); ?>
444 </button>
445 <button type="button" id="subscrpt-btn-save" class="wpsubs-btn wpsubs-btn--primary">
446 <?php esc_html_e( 'Create product', 'subscription' ); ?> &rsaquo;
447 </button>
448 </div>
449 </div>
450
451 <!-- =========================================== -->
452 <!-- SECTION 3: Completion -->
453 <!-- =========================================== -->
454 <div class="wpsubs-wizard-section <?php echo 3 === $wizard_page ? 'active' : ''; ?>" id="subscrpt-section-3">
455 <div class="wpsubs-wizard-card wpsubs-p3-card">
456
457 <!-- Success icon -->
458 <div class="wpsubs-p3-success-icon">
459 <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">
460 <polyline points="20 6 9 17 4 12"></polyline>
461 </svg>
462 </div>
463
464 <h1 class="wpsubs-p3-heading"><?php esc_html_e( 'Your product is live.', 'subscription' ); ?></h1>
465 <p class="wpsubs-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>
466
467 <?php
468 if ( $product ) :
469 $p3_price = $product->get_price();
470 $p3_period_raw = isset( $session_data['billing_period'] ) ? $session_data['billing_period'] : 'months';
471 $p3_billing_per = isset( $session_data['billing_per'] ) ? (int) $session_data['billing_per'] : 1;
472 $p3_period_label = $p3_billing_per > 1
473 ? $p3_billing_per . ' ' . strtolower( $p3_period_raw )
474 : strtolower( subscrpt_get_typos( 1, $p3_period_raw ) );
475 $p3_words = array_filter( explode( ' ', $product->get_name() ) );
476 $p3_initials = implode(
477 '',
478 array_map(
479 function ( $w ) {
480 return strtoupper( mb_substr( $w, 0, 1 ) );
481 },
482 array_slice( $p3_words, 0, 2 )
483 )
484 );
485 ?>
486 <!-- Product card -->
487 <div class="wpsubs-p3-product-card">
488 <div class="wpsubs-p3-product-card__header">
489 <span><?php esc_html_e( 'PRODUCT', 'subscription' ); ?></span>
490 <span><?php esc_html_e( 'STATUS', 'subscription' ); ?></span>
491 <span><?php esc_html_e( 'PRICE', 'subscription' ); ?></span>
492 </div>
493 <div class="wpsubs-p3-product-card__row">
494 <div class="wpsubs-p3-product-card__product">
495 <div class="wpsubs-p3-product-avatar"><?php echo esc_html( $p3_initials ); ?></div>
496 <div>
497 <p class="wpsubs-p3-product-name"><?php echo esc_html( $product->get_name() ); ?></p>
498 <p class="wpsubs-p3-product-meta">
499 <?php
500 /* translators: %d: product ID */
501 echo esc_html( sprintf( __( 'Product #%d', 'subscription' ), $product->get_id() ) );
502 ?>
503 &middot; <?php esc_html_e( 'Subscription', 'subscription' ); ?>
504 </p>
505 </div>
506 </div>
507 <div class="wpsubs-p3-product-card__status">
508 <span class="wpsubs-p3-status-badge">
509 <span class="wpsubs-p3-status-badge__dot"></span>
510 <?php esc_html_e( 'Published', 'subscription' ); ?>
511 </span>
512 <p class="wpsubs-p3-status-sub"><?php esc_html_e( 'Live in your shop', 'subscription' ); ?></p>
513 </div>
514 <div class="wpsubs-p3-product-card__price">
515 <span class="wpsubs-p3-price-amount"><?php echo wp_kses_post( wc_price( $p3_price ) ); ?></span>
516 <span class="wpsubs-p3-price-period">/ <?php echo esc_html( $p3_period_label ); ?></span>
517 </div>
518 </div>
519 </div>
520 <?php endif; ?>
521
522 <!-- What now -->
523 <p class="wpsubs-p3-what-now-label"><?php esc_html_e( 'WHAT NOW?', 'subscription' ); ?></p>
524
525 <div class="wpsubs-p3-action-rows">
526 <?php if ( $product ) : ?>
527 <a href="<?php echo esc_url( get_permalink( $product->get_id() ) ); ?>" target="_blank" rel="noopener" class="wpsubs-p3-action-row">
528 <div class="wpsubs-p3-action-row__icon">
529 <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>
530 </div>
531 <div class="wpsubs-p3-action-row__content">
532 <p class="wpsubs-p3-action-row__title"><?php esc_html_e( 'View product in shop', 'subscription' ); ?></p>
533 <p class="wpsubs-p3-action-row__desc"><?php esc_html_e( 'See how customers will subscribe to it.', 'subscription' ); ?></p>
534 </div>
535 <svg class="wpsubs-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>
536 </a>
537 <?php endif; ?>
538
539 <button type="button" id="subscrpt-btn-add-another" class="wpsubs-p3-action-row">
540 <div class="wpsubs-p3-action-row__icon">
541 <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>
542 </div>
543 <div class="wpsubs-p3-action-row__content">
544 <p class="wpsubs-p3-action-row__title"><?php esc_html_e( 'Add another product', 'subscription' ); ?></p>
545 <p class="wpsubs-p3-action-row__desc"><?php esc_html_e( 'Create another subscription product now.', 'subscription' ); ?></p>
546 </div>
547 <svg class="wpsubs-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>
548 </button>
549
550 </div>
551
552 <p class="wpsubs-p3-help-text">
553 <?php esc_html_e( 'Need help? Check the', 'subscription' ); ?>
554 <a href="https://docs.wpsubscription.co/en?utm_source=plugin&utm_medium=admin&utm_campaign=docs" target="_blank" rel="noopener" class="wpsubs-p3-help-link"><?php esc_html_e( 'setup guide', 'subscription' ); ?></a>
555 <?php esc_html_e( 'or', 'subscription' ); ?>
556 <a href="https://wordpress.org/support/plugin/subscription/" target="_blank" rel="noopener" class="wpsubs-p3-help-link"><?php esc_html_e( 'contact support', 'subscription' ); ?></a>.
557 </p>
558 </div>
559
560 <!-- Bottom nav -->
561 <div class="wpsubs-p3-nav">
562 <button type="button" id="subscrpt-btn-start-over" class="wpsubs-btn wpsubs-btn--outline">
563 <?php esc_html_e( 'Start over', 'subscription' ); ?>
564 </button>
565 <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=product' ) ); ?>" class="wpsubs-btn wpsubs-btn--primary">
566 <?php esc_html_e( 'Go to products', 'subscription' ); ?>
567 </a>
568 </div>
569 </div>
570 </div>
571