# subscription/2.2.0/includes/Admin/views/cancellation-flow.php

Subscriptions for WooCommerce with Stripe Recurring Payments, version 2.2.0. 139 lines.

- Page: https://pluginprobe.com/plugins/subscription/2.2.0/code/includes/Admin/views/cancellation-flow.php
- Raw: https://pluginprobe.com/plugins/subscription/2.2.0/raw/includes/Admin/views/cancellation-flow.php
- Modified: 2026-09-14T12:17:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/subscription/2.2.0/code/includes/Admin/views/cancellation-flow.php#L10-L20`.

```php
<?php
/**
 * Cancellation Flow view.
 *
 * Intro card, tab strip, then a two-column body: the active tab on the left and
 * the flow-wide options on the right.
 *
 * The form posts to options.php under the page's own settings group, so a save
 * here touches these options and nothing else - see CancellationFlow::OPTION_GROUP.
 *
 * @var string $active_tab Active tab key.
 * @var array  $tabs       Tab definitions.
 * @var string $page_url   Base page URL.
 *
 * @package SpringDevs\Subscription\Admin
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use SpringDevs\Subscription\Admin\CancellationFlow;
use SpringDevs\Subscription\Admin\SettingsHelper;
use SpringDevs\Subscription\Illuminate\Cancellation;
?>
<div class="wp-subscription-admin-content list-page">

	<?php
	wpsubs_render_page_header(
		array(
			'title'       => __( 'Cancellation Flow', 'subscription' ),
			'description' => __( 'Customize what customers see when they cancel, and record why they leave.', 'subscription' ),
		)
	);
	?>

	<div class="wpsubs-table-card" style="padding:18px 20px;margin-bottom:18px;background:var(--wpsubs-surface-muted,#f9fafb);">
		<ul style="margin:0 0 14px;padding-left:18px;color:var(--wpsubs-text-muted);font-size:13px;line-height:1.9;">
			<li><?php esc_html_e( 'Ask customers why they are leaving, and record it for churn tracking', 'subscription' ); ?></li>
			<li><?php esc_html_e( 'Choose the reasons they pick from, and when a cancellation takes effect', 'subscription' ); ?></li>
		</ul>
		<div style="display:flex;align-items:center;gap:20px;flex-wrap:wrap;">
			<a href="https://docs.wpsubscription.co/en/category/wpsubscription" target="_blank" rel="noopener" class="wpsubs-btn wpsubs-btn--muted wpsubs-btn--sm">
				<span class="dashicons dashicons-external" aria-hidden="true"></span>
				<?php esc_html_e( 'View All Documentation', 'subscription' ); ?>
			</a>
			<a href="https://wpsubscription.co/contact/" target="_blank" rel="noopener" class="wpsubs-btn wpsubs-btn--muted wpsubs-btn--sm">
				<span class="dashicons dashicons-editor-help" aria-hidden="true"></span>
				<?php esc_html_e( 'Get Support', 'subscription' ); ?>
			</a>
		</div>
	</div>

	<div class="wpsubs-tabs__list" role="tablist" style="margin-bottom:16px;">
		<?php foreach ( $tabs as $subscrpt_tab_key => $subscrpt_tab ) : ?>
			<a
				class="wpsubs-tabs__tab"
				role="tab"
				href="<?php echo esc_url( add_query_arg( 'tab', $subscrpt_tab_key, $page_url ) ); ?>"
				aria-selected="<?php echo $subscrpt_tab_key === $active_tab ? 'true' : 'false'; ?>"
			><?php echo esc_html( $subscrpt_tab['label'] ); ?></a>
		<?php endforeach; ?>
	</div>

	<form method="post" action="options.php" class="subscrpt-settings">
		<?php settings_fields( CancellationFlow::OPTION_GROUP ); ?>

		<div class="subscrpt-flow__layout">

			<div>
				<?php if ( 'reasons' === $active_tab ) : ?>
					<div class="wpsubs-table-card subscrpt-flow__panel subscrpt-flow__panel--reasons">
						<?php
						// The list in the order customers see it. It is rendered from what is
						// saved, and cancellation-flow.js keeps it in step with the editor, so
						// an edit shows here as soon as the modal closes, before saving. The
						// automatic "Other" is shown last, as customers see it, but marked as
						// not part of the list.
						$subscrpt_reasons    = Cancellation::get_configured_reasons();
						$subscrpt_auto_other = Cancellation::is_feedback_comment_enabled();
						?>
						<p class="subscrpt-flow__empty" data-subscrpt-reason-empty<?php echo empty( $subscrpt_reasons ) ? '' : ' hidden'; ?>>
							<?php esc_html_e( 'No reasons of your own yet - customers are offered the default reasons until you add one.', 'subscription' ); ?>
						</p>
						<ol class="subscrpt-flow__reasons" data-subscrpt-reason-preview<?php echo empty( $subscrpt_reasons ) ? ' hidden' : ''; ?>>
							<?php foreach ( $subscrpt_reasons as $subscrpt_reason ) : ?>
								<li><?php echo esc_html( $subscrpt_reason['label'] ?? '' ); ?></li>
							<?php endforeach; ?>
							<?php if ( $subscrpt_auto_other ) : ?>
								<li class="subscrpt-flow__reason--auto" data-subscrpt-reason-auto>
									<?php esc_html_e( 'Other', 'subscription' ); ?>
									<em class="subscrpt-flow__reason-note"><?php esc_html_e( 'Added automatically while Survey Comment Box is on', 'subscription' ); ?></em>
								</li>
							<?php endif; ?>
						</ol>
						<?php
						$subscrpt_reasons_field          = CancellationFlow::reasons_field();
						$subscrpt_reasons_field['title'] = '';
						SettingsHelper::render_settings_field( 'editlist', $subscrpt_reasons_field );
						?>
					</div>
				<?php endif; ?>

				<?php if ( 'offers' === $active_tab ) : ?>
					<div class="wpsubs-table-card subscrpt-flow__panel">
						<?php
						foreach ( CancellationFlow::offer_fields() as $subscrpt_offer_field ) {
							SettingsHelper::render_settings_field( $subscrpt_offer_field['type'], $subscrpt_offer_field['field_data'] );
						}
						?>
						<p class="subscrpt-flow__note">
							<?php esc_html_e( 'Accepting the offer issues a single-use WooCommerce coupon locked to that customer, and keeps the subscription.', 'subscription' ); ?>
						</p>
					</div>
				<?php endif; ?>
			</div>

			<aside>
				<div class="wpsubs-table-card subscrpt-flow__panel subscrpt-flow__options">
					<?php
					foreach ( CancellationFlow::sidebar_fields() as $subscrpt_field ) {
						SettingsHelper::render_settings_field( $subscrpt_field['type'], $subscrpt_field['field_data'] );
					}
					?>
				</div>
			</aside>

		</div>

		<div style="margin-top:18px;display:flex;align-items:center;gap:12px;">
			<button type="submit" class="wpsubs-btn wpsubs-btn--primary">
				<?php esc_html_e( 'Save Changes', 'subscription' ); ?>
			</button>
			<span class="subscrpt-flow__unsaved" data-subscrpt-unsaved hidden><?php esc_html_e( 'Unsaved changes', 'subscription' ); ?></span>
		</div>
	</form>

</div>

```
