Hooks and filters
| Hook | Type | Arguments | Purpose | |
|---|---|---|---|---|
sstw_admin_tabs | Filter | $tabs | Add or change admin tabs (slug => label and render callback). | |
sstw_ai_pre_response | Filter | $raw, $purpose, $system, $user, $schema | Return a value to replace the AI call. Used for tests. | |
sstw_approval_apply_allowed | Filter | bool $allowed, array $proposal | Return anything other than true to block applying. | |
sstw_approval_expiry_seconds | Filter | $seconds | Proposal lifetime. | |
sstw_capability | Filter | $capability | Capability needed for everything. Default manage_woocommerce. | |
sstw_coupon_create_validate | Filter | `true\ | WP_Error $ok, array $def, array $payload` | Validate a coupon.create step when it is proposed, approved and applied. Return a WP_Error to refuse it. |
sstw_coupon_source | Filter | $label, $coupon | Label which tool created a coupon. | |
sstw_daily_jobs | Filter | $jobs | Add or remove daily scheduled jobs. | |
sstw_defect_watch_ids | Filter | $product_ids | Product IDs kept out of campaigns. | |
sstw_integrations_active | Filter | $active | Override which integrations (SmartCouponX, Review Next) count as active. | |
sstw_review_triaged | Action | $comment_id, $row | Runs after a review has been triaged. | |
sstw_store_dashboard_url | Filter | $url | Licence keys page URL. | |
sstw_storeengine_allow_local | Filter | $allow | Whether local and staging sites may activate. | |
sstw_storeengine_product_id | Filter | $product_id | StoreEngine product ID used for licensing. | |
sstw_storeengine_store_url | Filter | $url | StoreEngine store URL used for licensing. |
Example: block all applying during a maintenance window.
add_filter( 'sstw_approval_apply_allowed', function ( $allowed, $proposal ) {
return get_option( 'my_maintenance_mode' ) ? false : $allowed;
}, 10, 2 );
Example: let shop managers and editors use the plugin.
add_filter( 'sstw_capability', function () {
return 'edit_shop_orders';
} );
Was this article helpful?
Tell us what was missing
