Comprehensive reference of all slswc_* actions and filters. Organized by category.
Settings
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_slug | filter | (string $prefix) | Filter the plugin option prefix (default: slswc_) | class-slswc.php |
slswc_get_sections_{id} | filter | (array $sections) | Filter settings sections for a settings page | class-slswc-settings-provider.php |
slswc_get_settings_{id} | filter | (array $settings) | Filter settings fields for a settings page | class-slswc-settings-provider.php |
slswc_before_save_settings | filter | (array $values) | Filter values before saving settings | class-slswc-settings-provider.php |
slswc_renewal_periods_settings | filter | (array $settings) | Filter renewal period settings fields | class-slswc-settings-provider.php |
slswc_renewal_periods | filter | (array $periods) | Filter available renewal periods | class-slswc.php |
slswc_renewal_period_defaults | filter | (array $defaults) | Filter default renewal periods | class-slswc.php |
slswc_get_renewal_periods | filter | (array $periods) | Filter merged renewal periods (defaults + custom) | class-slswc.php |
slswc_renewal_periods_to_save | filter | (array $periods) | Filter periods before persistence via REST API | class-slswc-settings-api.php |
slswc_email_reminder_length_defaults | filter | (array $defaults) | Filter default email reminder lengths | class-slswc.php |
slswc_server_tools | filter | (array $tools) | Map of tool ID => callable run when the tool is executed | class-slswc-tools.php |
slswc_tools_settings | filter | (array $settings) | Filter the Tools tab fields; add a tool-button field to show a button for a custom tool | class-slswc-settings-provider.php |
slswc_tools_process_{tool_id} | action | (SLSWC_Tools $tools) | Fired after a tool's callable runs via POST /slswc/v1/settings/tools/{tool_id} | class-slswc-tools.php |
License Lifecycle
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_license_activated_notification | action | (SLSWC_License $license, array $domain_data) | Fired when a license is activated on a domain | class-slswc-license.php |
slswc_license_deactivated_notification | action | (SLSWC_License $license, array $domain_data) | Fired when a license is deactivated from a domain | class-slswc-license.php |
slswc_license_max_activations_notification | action | (SLSWC_License $license) | Fired when activation limit is reached | class-slswc-license.php |
slswc_license_expired_notifications | action | (SLSWC_License $license, WC_Mailer $mailer) | Fired when a license expires | class-slswc-woocommerce-license.php |
slswc_license_expiring_notifications | action | (SLSWC_License $license, WC_Mailer $mailer) | Fired when a license is about to expire | class-slswc-woocommerce-license.php |
slswc_license_renewed_notification | action | (SLSWC_License $license) | Fired when a license is renewed | class-slswc-myaccount-api.php, class-slswc-woocommerce-subscriptions.php |
slswc_license_recovery_notification | action | (array $licenses, WP_User $user) | Fired to send a license recovery email | class-slswc-license-recovery-api.php |
slswc_activate_result | filter | (array $result) | Filter the activation result array | class-slswc-license.php |
slswc_deactivate_result | filter | (array $result) | Filter the deactivation result array | class-slswc-license.php |
slswc_license_expiry | filter | (string $expiry, string $purchase_date) | Filter computed license expiry date | class-slswc-license.php |
slswc_expired_within | filter | (int $days) | Filter the "expired within" threshold | class-slswc-license.php |
slswc_save_max_activation_status | filter | (bool $save) | Whether to persist max-activation status | class-slswc-license.php |
slswc_save_max_staging_activation_status | filter | (bool $save) | Whether to persist max-staging-activation status | class-slswc-license.php |
slswc_license_not_exists_msg | filter | (string $message) | Filter "license does not exist" error message | class-slswc-license.php |
slswc_license_domain_active_already_msg | filter | (string $message) | Filter "domain already active" error message | class-slswc-license.php |
slswc_license_error_message | filter | (string $message, string $error_code) | Filter any license error message | class-slswc-license.php |
Subscription Lifecycle
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_subscription_suspended | action | (object $subscription, string $gateway, string $gateway_sub_id) | Fired when a subscription is suspended | class-slswc-woocommerce-subscriptions.php |
slswc_subscription_cancelled | action | (object $subscription, string $gateway, string $gateway_sub_id) | Fired when a subscription is cancelled, including when its order is fully refunded | class-slswc-woocommerce-subscriptions.php, class-slswc-woocommerce-orders.php |
slswc_subscription_canceled_notification | action | (object $subscription) | Fired to send cancellation notification email | class-slswc-woocommerce-subscriptions.php |
slswc_subscription_resumed | action | (object $subscription, string $gateway, string $gateway_sub_id) | Fired when a subscription is resumed | class-slswc-woocommerce-subscriptions.php |
slswc_subscription_expired_notification | action | (object $subscription) | Fired when a subscription expires | class-slswc-scheduled-actions.php |
slswc_subscription_expiring_notification | action | (object $subscription) | Fired when a subscription is about to expire | class-slswc-scheduled-actions.php |
slswc_retry_subscription_payment | action | (object $subscription) | Fired by the scheduled action to retry a failed subscription payment | class-slswc-scheduled-actions.php |
slswc_retry_payment_succeeded | action | (int $subscription_id) | Fired when a payment retry succeeds | Gateway classes |
slswc_admin_daily_summary_notification | action | (array $summary) | Fired to send the daily admin summary email | class-slswc-scheduled-actions.php |
slswc_run_one_time_events | action | Fired by the slswc_one_time_events scheduled action | class-slswc-scheduled-actions.php |
Support
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_support_ticket_created_customer | action | (object $ticket) | Fired when a ticket is created (customer notification) | class-slswc-support-service.php |
slswc_support_ticket_created_admin | action | (object $ticket) | Fired when a ticket is created (admin notification) | class-slswc-support-service.php |
slswc_support_reply_notification | action | (object $ticket, int $message_id) | Fired when a reply is added to a ticket | class-slswc-support-service.php |
slswc_support_status_changed | action | (object $ticket, string $new_status) | Fired when a ticket status changes | class-slswc-support-service.php |
slswc_support_ticket_closed | action | (object $ticket) | Fired when a ticket is closed | class-slswc-support-service.php |
slswc_support_ticket_assigned | action | (object $ticket, int $agent_id) | Fired when a ticket is assigned to staff | class-slswc-support-service.php |
slswc_support_agent_access | action | (object $agent, object $license, WP_User $inviter) | Fired when an agent is granted access | class-slswc-support-service.php |
slswc_support_agent_invitation | action | (object $agent, object $license, WP_User $inviter) | Fired to send an agent invitation email | class-slswc-support-service.php |
slswc_support_ticket_prefix | filter | (string $prefix) | Filter ticket number prefix (default: TIC-) | class-slswc-support-ticket.php |
API
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_api_namespace | filter | (string $namespace) | Filter the REST API namespace (default: slswc/v1) | class-slswc-api.php |
slswc_api_connect_enabled | filter | (bool $enabled) | Whether the /connect endpoint is enabled | class-slswc-api.php |
slswc_api_connect_permission_check | filter | (bool $granted, WP_REST_Request $request) | Filter connect endpoint permission | class-slswc-api.php |
slswc_remove_domain_roles | filter | (array $roles) | Roles allowed to remove domains (default: ['administrator']) | class-slswc-api.php |
slswc_get_user_purchased_products | filter | (array $products, int $user_id, array $args) | Filter user purchased products (flat list keyed by product_id) | class-slswc-api.php |
slswc_all_licenses | filter | (array $formatted, array $raw) | Filter admin license list | class-slswc-api.php |
slswc_all_customer_licenses | filter | (array $formatted, array $raw) | Filter customer license list | class-slswc-api.php |
slswc_get_licenses_where | filter | (array $formatted, array $raw) | Filter filtered license query results | class-slswc-api.php |
slswc_get_order_licenses | filter | (array $licenses, int $order_id, string $return_type, array $raw) | Filter licenses for a specific order | class-slswc-api.php |
slswc_get_licensed_customer_ids | filter | (array $ids, string $status) | Filter licensed customer IDs | class-slswc-api.php |
slswc_get_licensed_customer_details | filter | (array $customers, string $status) | Filter licensed customer details | class-slswc-api.php |
slswc_get_expiring_customers | filter | (array $customers) | Filter expiring customers list | class-slswc-api.php |
Cache Expiry
SLSWC exposes a filter for the lifetime of each cached API response and license query (for example slswc_check_license_cache_expiry and slswc_composer_packages_cache_expiry). See Cache Expiry Filters for the full list with defaults and examples.
Product
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_software_meta_data_saved | action | (int $product_id, array $meta) | Fired after software product meta is saved | class-slswc-woocommerce-products.php |
slswc_software_variation_meta_data_saved | action | (int $variation_id, int $index, array $meta) | Fired after variation meta is saved | class-slswc-woocommerce-products.php |
slswc_updated_license_data_for_product_{id} | action | (int $product_id, array $license_data, SLSWC_WooCommerce_License $license) | Fired for each license after its data is updated from the product | class-slswc-woocommerce-products.php |
slswc_updated_license_data_for_product{id} | action | (array $license_data) | Fired once after all of a product's licenses are updated. Note: no underscore before the product ID | class-slswc-woocommerce-products.php |
slswc_set_software_props | filter | (array $props) | Legacy: filter software product properties when saving. Only applied on WooCommerce older than 3.0 | class-slswc-woocommerce-products.php |
slswc_software_to_array_{id} | filter | (array $data, WC_Product $product) | Filter software product array representation | trait-slswc-product-software.php |
slswc_variable_software_children | filter | (array $children, WC_Product $product) | Filter variable software product children | class-wc-product-variable-software.php |
slswc_meta_keys_to_props | filter | (array $mapping) | Filter meta key to property mapping | Data store classes |
slswc_software_type_fields | filter | (array $fields) | Filter software type product fields | class-slswc.php |
slswc_license_status_types | filter | (array $types) | Filter available license status types | class-slswc.php |
slswc_show_software_tabs | filter | (string $show) | Whether to show software tabs on product page | class-slswc-woocommerce-product.php |
slswc_show_description_tab | filter | (string $show) | Show product description tab | class-slswc-woocommerce-product.php |
slswc_show_installation_tab | filter | (string $show) | Show product installation tab | class-slswc-woocommerce-product.php |
slswc_show_changelog_tab | filter | (string $show) | Show product changelog tab | class-slswc-woocommerce-product.php |
slswc_software_tabs | filter | (array $software_tabs) | Filter the software tabs (description, installation, changelog) added to the single product page. Each entry has title, priority and callback. Built from the plugin prefix | class-slswc-woocommerce-product.php |
slswc_software_license_product_fields | filter | (array $fields) | Filter the field definitions in the License tab of the product editor | class-slswc-woocommerce-products.php |
slswc_license_panel_path | filter | (string $path) | Filter the path of the template file included for the License tab panel | class-slswc-woocommerce-products.php |
slswc_supported_product_types | filter | (array $types) | Product types whose software data is saved by the product editor (default: software, variable-software) | class-slswc-woocommerce-products.php |
slswc_software_product_types | filter | (array $types) | Product types treated as software products (default: software, variable-software) | class-slswc-product-helper.php |
Payment Gateway
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_payment_gateways | filter | (array $gateways) | Register payment gateway classes | class-slswc-payment-gateways.php |
slswc_payment_gateway_form_fields | filter | (array $fields) | Filter Stripe gateway form fields | Stripe gateway |
slswc_payfast_gateway_form_fields | filter | (array $fields) | Filter PayFast gateway form fields | PayFast gateway |
slswc_cards_payment_fields | action | (string $gateway_id) | Fired during Stripe payment fields rendering | Stripe gateway |
slswc_stripe_thankyou_rendered | action | Fired after Stripe thank you page renders | Stripe gateway | |
slswc_checkout_verify_zip | filter | (bool $verify) | Whether Stripe should verify ZIP code | Stripe gateway |
slswc_checkout_require_billing_address | filter | (bool $require) | Whether Stripe requires billing address | Stripe gateway |
slswc_checkout_require_shipping_address | filter | (bool $require) | Whether Stripe requires shipping address | Stripe gateway |
slswc_checkout_locale | filter | (string $locale) | Filter checkout locale for Stripe | Stripe gateway |
slswc_allow_remember_me | filter | (bool $allow) | Allow "Remember Me" on Stripe checkout | Stripe gateway |
slswc_description | filter | (string $desc, string $gateway_id) | Filter gateway description | Stripe gateway |
slswc_display_save_payment_method_checkbox | filter | (bool $display) | Show tokenization checkbox | Stripe gateway |
slswc_payfast_valid_ips | filter | (array $ips) | Filter valid PayFast notification IPs | PayFast gateway |
slswc_stripe_elements_options | filter | (array $options) | Filter the data localised to window.slswc_stripe_elements for the Stripe card fields. Keys: publishable_key, ajax_url, nonce, client_secret, api_version, order_id. Optional elements_styling and elements_classes (Stripe Elements style and classes) only apply to the legacy separate card fields, used when there is no PaymentIntent client secret (for example pay-for-order or add payment method) | class-slswc-payment-gateway-stripe.php |
Composer Repository
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_composer_packages_json | filter | (array $output, int $customer_id) | Filter the packages.json output | class-slswc-composer-repository.php |
slswc_composer_packages_cache_expiry | filter | (int $seconds) | Filter packages.json cache TTL (default: 1 hour) | class-slswc-composer-repository.php |
slswc_composer_valid_license_statuses | filter | (array $statuses) | Filter statuses included in Composer (default: active, inactive, expiring) | class-slswc-composer-repository.php |
slswc_composer_package_entry | filter | (array $entry, WC_Product $product) | Filter a single Composer package entry | class-slswc-composer-repository.php |
DRM (Client Library)
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_drm_config_{identifier} | filter | (array $config) | Modify DRM configuration | DRM.php |
slswc_drm_state_{identifier} | filter | (string $state, DRM $drm) | Override computed DRM state | DRM.php |
slswc_drm_notice_html_{identifier} | filter | (string $html, string $state, string $status, DRM $drm) | Modify notice HTML | DRM.php |
slswc_drm_should_lock_page_{identifier} | filter | (bool $lock, DRM $drm) | Prevent interstitial lock | DRM.php |
slswc_drm_interstitial_html_{identifier} | filter | (string $html, DRM $drm) | Modify interstitial HTML | DRM.php |
WooCommerce Integration
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_after_load_woocommerce_hooks | action | Fired after all WooCommerce hooks are loaded | class-slswc-woocommerce.php | |
slswc_add_endpoints | action | Fired to allow adding custom My Account endpoints | class-slswc-woocommerce-my-account.php | |
slswc_my_account_query_vars | filter | (array $vars) | Filter My Account query vars | class-slswc-woocommerce-my-account.php |
slswc_my_account_menu_links | filter | (array $top_items, array $items) | Filter My Account menu items | class-slswc-woocommerce-my-account.php |
slswc_renewal_url | filter | (string $url) | Filter the renewal checkout URL | class-slswc.php |
slswc_delete_licenses_when_deleting_order | filter | (bool $delete, int $order_id) | Whether to delete licenses when an order is deleted (default: true). Runs on woocommerce_before_delete_order, for both HPOS and legacy order storage | class-slswc-woocommerce-orders.php |
slswc_license_failed_notice | filter | (string $message) | Filter license generation failure notice | class-slswc-woocommerce-orders.php |
slswc_license_order_item_meta_label | filter | (string $label) | Filter "License Key" meta label on orders | class-slswc-woocommerce-orders.php |
slswc_license_added_notice | filter | (string $message) | Filter license added order note | class-slswc-woocommerce-orders.php |
slswc_product_update_download_file_url | filter | (string $url, array $download, array $args) | Filter download file URL | class-slswc-woocommerce-my-account.php |
slswc_product_update_obfuscated_download_url | filter | (string $url, array $download, array $args) | Filter obfuscated download URL | class-slswc-woocommerce-my-account.php |
slswc_get_served_download_file | filter | (array $download, array $args) | Filter served download file data | class-slswc-woocommerce-my-account.php |
Environment Detection
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_is_staging | filter | (bool $is_staging, string $domain) | Override staging detection | class-slswc.php |
slswc_is_dev | filter | (bool $is_dev, string $url, string $environment) | Override dev environment detection | class-slswc.php |
slswc_server_live_subdomain | filter | (bool $is_live) | Override live subdomain detection | class-slswc.php |
slswc_validate_tlds | filter | (bool $check) | Whether to check TLDs for dev detection | class-slswc.php |
slswc_is_ip_local | filter | (bool $is_local, string $host) | Override local IP detection | class-slswc.php |
slswc_is_tld_dev | filter | (bool $is_dev, string $host) | Override TLD-based dev detection | class-slswc.php |
slswc_is_subdomain_dev | filter | (bool $is_dev, string $host) | Override subdomain-based dev detection | class-slswc.php |
Reports
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_subscription_renewal_count | filter | (int $count, string $start, string $end) | Filter subscription renewal count | class-slswc-reports-helper.php |
slswc_get_license_renewal_count | filter | (int $count, string $start, string $end) | Filter license renewal count | class-slswc-reports-helper.php |
slswc_get_subscription_customers_within_range | filter | (int $count, string $start, string $end) | Filter subscription customers count in date range | class-slswc-reports-helper.php |
slswc_get_license_customers_within_range | filter | (int $count, string $start, string $end) | Filter license customers count in date range | class-slswc-reports-helper.php |
slswc_get_subscription_customers_at_start | filter | (int $count, string $start) | Filter customers at period start | class-slswc-reports-helper.php |
slswc_get_license_customers_at_start | filter | (int $count, string $start) | Filter license customers at period start | class-slswc-reports-helper.php |
slswc_get_subscription_customers_at_end | filter | (int $count, string $end) | Filter customers at period end | class-slswc-reports-helper.php |
slswc_get_license_customers_at_end | filter | (int $count, string $end) | Filter license customers at period end | class-slswc-reports-helper.php |
Utilities
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_formatted_start_date | filter | (string $start_date) | Filter formatted start date used in range queries | class-slswc-utils.php |
slswc_formatted_end_date | filter | (string $end_date) | Filter formatted end date used in range queries | class-slswc-utils.php |
slswc_license_view_url | filter | (string $html) | Filter the license admin view link HTML | class-slswc-license.php |
Logging
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_debug_enabled | filter | (bool $enabled) | Whether debug logging is enabled | class-slswc-logging.php |
slswc_stripe_logging_enabled | filter | (bool $enabled) | Whether Stripe-specific logging is enabled | class-slswc-logger.php |
AJAX
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_ajax_{action} | action | Dispatched for custom AJAX actions | class-slswc-ajax.php |
UI (Admin Panel)
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_license_panel_field_{type} | action | (string $key, array $details) | Render a custom field type in the license panel | slswc-wc-license-panel.php, license-panel.php |
Setup Wizard
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_recommended_plugins | filter | (array[] $plugins) | Filter the plugins recommended in the setup wizard. Each entry has slug and basename (both required; entries without them are dropped), plus name, description, icon, admin_url, admin_label, and optional requires_php / requires_wp minimum versions | class-slswc-recommended-plugins.php |
slswc_client_sdk_url | filter | (string $url) | Filter the client SDK documentation link shown in the setup wizard (default: https://licenseserver.io/documentation/client-sdk) | class-slswc-setup-wizard.php |
Client Library โ API & Updates
Hooks in libraries/slswc/client/src/ for themes/plugins that consume the SLSWC license server.
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_request_info_{text_domain} | filter | (array $request_info) | Filter request data before sending to license server | ApiClient.php |
slswc_request_options_{text_domain} | filter | (array $options) | Filter wp_safe_remote_get/post options (timeout, etc.) | ApiClient.php |
slswc_client_get_actions | filter | (array $actions) | Filter which API actions use GET instead of POST (default: product, products) | ApiClient.php |
slswc_api_connected | filter | (string $connected) | Filter the "connected" flag stored by the updater | Updater.php |
slswc_api_connected_{text_domain} | filter | (string $connected) | Filter per-product "connected" flag | ApiClient.php |
slswc_api_auth_user | filter | (string $auth_user) | Filter the authenticated user stored by the updater | Updater.php |
slswc_api_auth_user_{text_domain} | filter | (string $auth_user) | Filter per-product authenticated user | ApiClient.php |
slswc_themes_cache_expiry | filter | (int $seconds) | Cache TTL for local themes list (default: 2 hours) | Updater.php |
slswc_plugins_cache_expiry | filter | (int $seconds) | Cache TTL for local plugins list (default: 2 hours) | Updater.php |
slswc_updater_license_data_for_all{type} | filter | (array $licenses_data) | Filter all license data; {type} is themes or plugins (or empty for all) | Updater.php |
slswc_client_default_license_options | filter | (array $options) | Filter default license option values | LicenseDetails.php |
Client Library โ Product Data
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_client_formatted_plugin_data | filter | (array $data, array $raw, string $file) | Filter formatted plugin data before use | Helper.php |
slswc_client_formatted_theme_data | filter | (array $data, WP_Theme $theme, string $file) | Filter formatted theme data before use | Helper.php |
slswc_client_mapped_remote_product | filter | (array $local, array $remote) | Filter local product data after mapping remote values | Helper.php |
Client Library โ License UI
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_save_license_{slug} | action | (array $license_details) | Fired when a license is saved from the licenses page | Updater.php |
slswc_after_plugins_licenses_rows | action | Fired after plugin license rows are rendered | Updater.php | |
slswc_after_themes_licenses_list | action | Fired after theme license rows are rendered | Updater.php | |
slswc_after_products_licenses_list | action | (array $plugins, array $themes) | Fired after all license rows are rendered | Updater.php |
Client Library โ Logging
| Hook | Type | Parameters | Description | File |
|---|---|---|---|---|
slswc_client_logging | filter | (bool $enabled) | Whether client-side logging is enabled (also controlled by SLSWC_CLIENT_LOGGING constant) | Helper.php |
Common Patterns
Below are real-world implementation examples showing how to combine these hooks.
Adding a Custom Tool
Register a tool in the SLSWC Settings > Tools tab and handle its execution. Clicking the button sends POST /wp-json/slswc/v1/settings/tools/{tool_id} (requires manage_options), which calls the registered callable and then fires slswc_tools_process_{tool_id}:
// Register the callable that runs the tool.
add_filter( 'slswc_server_tools', function ( $tools ) {
$tools['reset_staging_activations'] = 'my_reset_staging_activations';
return $tools;
} );
// Add the button to the Tools tab, before the closing sectionend field.
add_filter( 'slswc_tools_settings', function ( $settings ) {
$button = array(
'title' => __( 'Reset Staging Activations', 'my-extension' ),
'desc' => __( 'Clear all staging domain activations across all licenses.', 'my-extension' ),
'id' => 'reset_staging_activations',
'type' => 'tool-button',
);
array_splice( $settings, count( $settings ) - 1, 0, array( $button ) );
return $settings;
} );
function my_reset_staging_activations() {
// Your logic to reset staging activations...
}
// Optional: run follow-up work after the tool's callable.
add_action( 'slswc_tools_process_reset_staging_activations', function ( $tools ) {
// Your follow-up logic...
} );
Filtering License Activation Results
Modify the response returned when a license is activated โ for example, to include custom metadata:
add_filter( 'slswc_activate_result', function ( $result ) {
// Add a custom field to the activation response.
$result['support_url'] = 'https://your-store.com/support/';
$result['docs_url'] = 'https://your-store.com/docs/';
return $result;
} );
Custom DRM Configuration
Override DRM settings for a specific product from outside the product's own code โ useful for a site-wide licensing extension:
add_filter( 'slswc_drm_config_my-plugin', function ( $config ) {
// Give customers a more generous grace period.
$config['grace_soft_days'] = 5;
$config['grace_lock_days'] = 14;
// Customize the purchase URL for a seasonal promotion.
$config['purchase_url'] = 'https://your-store.com/black-friday/';
return $config;
} );
Tip: The
{identifier}in DRM filter names is typically the product's text domain. See the DRM docs for the full list of configuration options.
Hooking Into Support Ticket Events
Send a Slack notification when a support ticket is created or assigned:
add_action( 'slswc_support_ticket_created_admin', function ( $ticket ) {
wp_remote_post( 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL', array(
'body' => wp_json_encode( array(
'text' => sprintf( 'New support ticket: %s', $ticket->title ),
) ),
'headers' => array( 'Content-Type' => 'application/json' ),
) );
} );
add_action( 'slswc_support_ticket_assigned', function ( $ticket, $agent_id ) {
$agent = get_userdata( $agent_id );
// Notify the agent via your preferred channel...
}, 10, 2 );
Customizing Client Library API Requests
Add custom headers or increase the timeout for license server requests:
add_filter( 'slswc_request_options_my-plugin', function ( $options ) {
$options['timeout'] = 60;
$options['headers'] = array(
'X-Custom-Header' => 'my-value',
);
return $options;
} );
// Add extra data to the request sent to the license server.
add_filter( 'slswc_request_info_my-plugin', function ( $request_info ) {
$request_info['site_name'] = get_bloginfo( 'name' );
return $request_info;
} );
Reacting to Subscription Lifecycle Events
Log subscription events or trigger external integrations:
// Notify your CRM when a subscription is cancelled.
add_action( 'slswc_subscription_cancelled', function ( $subscription, $gateway, $gateway_sub_id ) {
my_crm_cancel_subscription( $subscription->customer_id, $gateway_sub_id );
}, 10, 3 );
// Auto-deactivate licenses when a subscription expires.
add_action( 'slswc_subscription_expired_notification', function ( $subscription ) {
// Your logic to handle expired subscription licenses...
} );