Developer guide

How the plugins are built, what they store, and how to extend them.

FreePro

Architecture

Data stored

A subscription is a private siteryn_subscription post: the customer is the post author, the status is the post status (ssm-active, ssm-on-hold…), and each property is post meta prefixed _siteryn_ssm_. Add-on data uses SubscriptionRepository::update_meta() (stored as _siteryn_ssm_x_{key}).

WhereKeyMeaning
Optionsiteryn_ssm_settingsFree settings (with a _schema version)
Optionsiteryn_ssm_version, siteryn_ssm_flush_rewrite_rulesInstalled version; one-time flag to rebuild links after the address changes
Optionsiteryn_ssm_pro_settings, siteryn_ssm_pro_versionPro settings and version
Optionssiteryn_license_subscription-manager_key, _status, _updatePro license state
Transientssiteryn_ssm_outdated_templates, siteryn_ssm_pro_mrrOutdated template check (1 day); dashboard revenue (1 hour)
Product meta_siteryn_ssm_subscription, _period, _interval, _length; Pro _siteryn_ssm_pro_switch_toSubscription settings; plans a product can switch to
Order line meta_siteryn_ssm_period, _interval, _length, _siteryn_ssm_subscription_idSchedule snapshot; the subscription the line created or renews
Order meta_siteryn_ssm_renewal_of, _siteryn_ssm_renewal_appliedOn renewal orders
Order meta (Pro)_siteryn_ssm_pro_switch_of, _switch_to, _switch_appliedOn prorated plan switch orders
Subscription data (Pro)pro_paused_at, pro_resume_at, pro_payment_method, pro_pending_switch, pro_switch_history, pro_reminded_for, pro_original_endPause dates, payment method, switching, reminders, cancellation
Subscription meta_siteryn_ssm_language, _siteryn_ssm_localeMultilingual sites only: the language the subscription was bought in

Functions

FunctionReturns
siteryn_ssm_is_loaded()Whether Free booted (bool)
siteryn_ssm()The running plugin instance, or null
siteryn_ssm_get_subscription( $id )A Subscription, or null
siteryn_ssm_get_customer_subscriptions( $customer_id )The customer's subscriptions, newest first (at most 100)
siteryn_ssm_customer_has_active_subscription( $customer_id, $product_id = 0 )Whether the customer has a Pending, Active or On hold subscription, optionally to one product
siteryn_ssm_is_subscription_product( $product )Whether a product (ID or object) is sold as a subscription
// Give members a discount when they have a live subscription.
$user_id = get_current_user_id();
if ( function_exists( 'siteryn_ssm_customer_has_active_subscription' )
	&& siteryn_ssm_customer_has_active_subscription( $user_id ) ) {
	// Pending, Active or On hold subscription found.
}

Public classes: Subscription (value object: getters, has_status(), get_schedule_text()), SubscriptionRepository (get(), save(), get_for_customer(), get_for_order(), query(), count_by_status()…), Lifecycle (update_status(), create_renewal_order(), add_note()…), SubscriptionStatus, ProductSubscription, Period, Display, Settings and Templates.

Templates

Copy a template to yourtheme/siteryn-subscription-manager/{template} to override it. Every template has an @version; System Status and an admin notice flag theme copies older than the plugin's.

TemplateVariables
myaccount/subscriptions.php$subscriptions, $current_page, $total_pages, $settings
myaccount/view-subscription.php$subscription, $actions, $orders, $settings
order/related-subscriptions.php$subscriptions, $order, $can_view, $settings
parts/status-badge.php$subscription
parts/subscription-actions.php$subscription, $actions, $context (list or view)

Pro's email template emails/subscription-notice.php (and emails/plain/subscription-notice.php) is overridden the WooCommerce way, in yourtheme/woocommerce/emails/.

CSS

Every template's wrapper has .siteryn-ssm plus .siteryn-ssm--list, --view, --order and .siteryn-ssm--badge-filled or --badge-outline. Status colors are custom properties on .siteryn-ssm: --siteryn-ssm-status-active, -on-hold, -pending, -cancelled, -expired. Badges are .siteryn-ssm-status.siteryn-ssm-status--{status}. The stylesheet loads only on My Account and order confirmation pages (filter siteryn_ssm_load_assets); the storefront loads no JavaScript.

Scheduled events and endpoints

Event / actionWhat it is
siteryn_ssm_process_subscriptionsHourly WP-Cron event: renewals, expiries, overdue cancellations; Pro adds auto-resume, pending cancellations and reminders
siteryn_ssm_pro_license_checkDaily Pro license refresh
wp_ajax_siteryn_ssm_save_settingsSaves a settings tab (manage_woocommerce, nonce)
wp_ajax_siteryn_ssm_pro_license_actionLicense activate, deactivate, refresh
admin_post_siteryn_ssm_reset_settings, admin_post_siteryn_ssm_pro_reset_settingsReset to Defaults
admin_post_siteryn_ssm_pro_save_subscription, admin_post_siteryn_ssm_pro_recurring_actionSubscription editor save and renewal actions

Customer actions (Pro) are plain requests to the subscription's page with siteryn_ssm_do, subscription and a nonce; confirmations use ?siteryn_ssm_confirm=cancel|switch|payment_method. There is no REST API.

Constants

ConstantValue
SITERYN_SSM_VERSION, SITERYN_SSM_PRO_VERSIONPlugin versions
SITERYN_SSM_API_VERSIONExtension API version
SITERYN_SSM_MIN_PHP_VERSION, _MIN_WP_VERSION, _MIN_WC_VERSION7.4, 6.4, 8.0
SITERYN_SSM_REMOVE_ALL_DATADefine as true before deleting the plugin to delete every subscription
SITERYN_SSM_PRO_LICENSE_API_BASELicense server, overridable in wp-config.php (for example for staging)