PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.0.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.0.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 1.4.1 1.4.2 1.5.0 1.5.1 All 61 releases
subscription / includes / Admin / views / cancellation-flow.php

cancellation-flow.php in Subscriptions for WooCommerce with Stripe Recurring Payments 2.0.0, at includes/Admin/views/cancellation-flow.php

139 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Cancellation Flow view.
4 *
5 * Intro card, tab strip, then a two-column body: the active tab on the left and
6 * the flow-wide options on the right.
7 *
8 * The form posts to options.php under the page's own settings group, so a save
9 * here touches these options and nothing else - see CancellationFlow::OPTION_GROUP.
10 *
11 * @var string $active_tab Active tab key.
12 * @var array $tabs Tab definitions.
13 * @var string $page_url Base page URL.
14 *
15 * @package SpringDevs\Subscription\Admin
16 */
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21
22 use SpringDevs\Subscription\Admin\CancellationFlow;
23 use SpringDevs\Subscription\Admin\SettingsHelper;
24 use SpringDevs\Subscription\Illuminate\Cancellation;
25 ?>
26 <div class="wp-subscription-admin-content list-page">
27
28 <?php
29 wpsubs_render_page_header(
30 array(
31 'title' => __( 'Cancellation Flow', 'subscription' ),
32 'description' => __( 'Customize what customers see when they cancel, and record why they leave.', 'subscription' ),
33 )
34 );
35 ?>
36
37 <div class="wpsubs-table-card" style="padding:18px 20px;margin-bottom:18px;background:var(--wpsubs-surface-muted,#f9fafb);">
38 <ul style="margin:0 0 14px;padding-left:18px;color:var(--wpsubs-text-muted);font-size:13px;line-height:1.9;">
39 <li><?php esc_html_e( 'Ask customers why they are leaving, and record it for churn tracking', 'subscription' ); ?></li>
40 <li><?php esc_html_e( 'Choose the reasons they pick from, and when a cancellation takes effect', 'subscription' ); ?></li>
41 </ul>
42 <div style="display:flex;align-items:center;gap:20px;flex-wrap:wrap;">
43 <a href="https://docs.wpsubscription.co/en/category/wpsubscription" target="_blank" rel="noopener" class="wpsubs-btn wpsubs-btn--muted wpsubs-btn--sm">
44 <span class="dashicons dashicons-external" aria-hidden="true"></span>
45 <?php esc_html_e( 'View All Documentation', 'subscription' ); ?>
46 </a>
47 <a href="https://wpsubscription.co/contact/" target="_blank" rel="noopener" class="wpsubs-btn wpsubs-btn--muted wpsubs-btn--sm">
48 <span class="dashicons dashicons-editor-help" aria-hidden="true"></span>
49 <?php esc_html_e( 'Get Support', 'subscription' ); ?>
50 </a>
51 </div>
52 </div>
53
54 <div class="wpsubs-tabs__list" role="tablist" style="margin-bottom:16px;">
55 <?php foreach ( $tabs as $subscrpt_tab_key => $subscrpt_tab ) : ?>
56 <a
57 class="wpsubs-tabs__tab"
58 role="tab"
59 href="<?php echo esc_url( add_query_arg( 'tab', $subscrpt_tab_key, $page_url ) ); ?>"
60 aria-selected="<?php echo $subscrpt_tab_key === $active_tab ? 'true' : 'false'; ?>"
61 ><?php echo esc_html( $subscrpt_tab['label'] ); ?></a>
62 <?php endforeach; ?>
63 </div>
64
65 <form method="post" action="options.php" class="subscrpt-settings">
66 <?php settings_fields( CancellationFlow::OPTION_GROUP ); ?>
67
68 <div class="subscrpt-flow__layout">
69
70 <div>
71 <?php if ( 'reasons' === $active_tab ) : ?>
72 <div class="wpsubs-table-card subscrpt-flow__panel subscrpt-flow__panel--reasons">
73 <?php
74 // The list in the order customers see it. It is rendered from what is
75 // saved, and cancellation-flow.js keeps it in step with the editor, so
76 // an edit shows here as soon as the modal closes, before saving. The
77 // automatic "Other" is shown last, as customers see it, but marked as
78 // not part of the list.
79 $subscrpt_reasons = Cancellation::get_configured_reasons();
80 $subscrpt_auto_other = Cancellation::is_feedback_comment_enabled();
81 ?>
82 <p class="subscrpt-flow__empty" data-subscrpt-reason-empty<?php echo empty( $subscrpt_reasons ) ? '' : ' hidden'; ?>>
83 <?php esc_html_e( 'No reasons of your own yet - customers are offered the default reasons until you add one.', 'subscription' ); ?>
84 </p>
85 <ol class="subscrpt-flow__reasons" data-subscrpt-reason-preview<?php echo empty( $subscrpt_reasons ) ? ' hidden' : ''; ?>>
86 <?php foreach ( $subscrpt_reasons as $subscrpt_reason ) : ?>
87 <li><?php echo esc_html( $subscrpt_reason['label'] ?? '' ); ?></li>
88 <?php endforeach; ?>
89 <?php if ( $subscrpt_auto_other ) : ?>
90 <li class="subscrpt-flow__reason--auto" data-subscrpt-reason-auto>
91 <?php esc_html_e( 'Other', 'subscription' ); ?>
92 <em class="subscrpt-flow__reason-note"><?php esc_html_e( 'Added automatically while Survey Comment Box is on', 'subscription' ); ?></em>
93 </li>
94 <?php endif; ?>
95 </ol>
96 <?php
97 $subscrpt_reasons_field = CancellationFlow::reasons_field();
98 $subscrpt_reasons_field['title'] = '';
99 SettingsHelper::render_settings_field( 'editlist', $subscrpt_reasons_field );
100 ?>
101 </div>
102 <?php endif; ?>
103
104 <?php if ( 'offers' === $active_tab ) : ?>
105 <div class="wpsubs-table-card subscrpt-flow__panel">
106 <?php
107 foreach ( CancellationFlow::offer_fields() as $subscrpt_offer_field ) {
108 SettingsHelper::render_settings_field( $subscrpt_offer_field['type'], $subscrpt_offer_field['field_data'] );
109 }
110 ?>
111 <p class="subscrpt-flow__note">
112 <?php esc_html_e( 'Accepting the offer issues a single-use WooCommerce coupon locked to that customer, and keeps the subscription.', 'subscription' ); ?>
113 </p>
114 </div>
115 <?php endif; ?>
116 </div>
117
118 <aside>
119 <div class="wpsubs-table-card subscrpt-flow__panel subscrpt-flow__options">
120 <?php
121 foreach ( CancellationFlow::sidebar_fields() as $subscrpt_field ) {
122 SettingsHelper::render_settings_field( $subscrpt_field['type'], $subscrpt_field['field_data'] );
123 }
124 ?>
125 </div>
126 </aside>
127
128 </div>
129
130 <div style="margin-top:18px;display:flex;align-items:center;gap:12px;">
131 <button type="submit" class="wpsubs-btn wpsubs-btn--primary">
132 <?php esc_html_e( 'Save Changes', 'subscription' ); ?>
133 </button>
134 <span class="subscrpt-flow__unsaved" data-subscrpt-unsaved hidden><?php esc_html_e( 'Unsaved changes', 'subscription' ); ?></span>
135 </div>
136 </form>
137
138 </div>
139