{"id":264948,"date":"2025-12-06T15:32:44","date_gmt":"2025-12-06T15:32:44","guid":{"rendered":"https:\/\/en-za.wordpress.org\/plugins\/session-shredder-for-woocommerce\/"},"modified":"2025-12-06T15:34:46","modified_gmt":"2025-12-06T15:34:46","slug":"session-shredder-for-woocommerce","status":"publish","type":"plugin","link":"https:\/\/ewe.wordpress.org\/plugins\/session-shredder-for-woocommerce\/","author":14592402,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.1.0","stable_tag":"1.1.0","tested":"6.9.4","requires":"6.0","requires_php":"8.0","requires_plugins":null,"header_name":"Session Shredder for WooCommerce","header_author":"Rynaldo Stoltz","header_description":"Smart, rule-based session pruner for WooCommerce 10.3+ that builds on the experimental guest sessions engine to safely clear out old, low-value sessions.","assets_banners_color":"b9a4c8","last_updated":"2025-12-06 15:34:46","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/mambaspeed.com\/session-shredder\/","header_author_uri":"https:\/\/mambaspeed.com","rating":0,"author_block_rating":0,"active_installs":0,"downloads":148,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.1.0":{"tag":"1.1.0","author":"Rynald0s","date":"2025-12-06 15:34:46"}},"upgrade_notice":{"1.1.0":"<ul>\n<li>Initial release<\/li>\n<\/ul>"},"ratings":[],"assets_icons":{"icon-256x256.png":{"filename":"icon-256x256.png","revision":3413052,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":{"banner-772x250.png":{"filename":"banner-772x250.png","revision":3413052,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.1.0"],"block_files":[],"assets_screenshots":[],"screenshots":{"1":"Session Shredder Dashboard, showing total sessions, pruned counts, and chart of recent prune runs."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[3786,187,247,30471,286],"plugin_category":[45,52,54],"plugin_contributors":[138716],"plugin_business_model":[],"class_list":["post-264948","plugin","type-plugin","status-publish","hentry","plugin_tags-cleanup","plugin_tags-optimization","plugin_tags-performance","plugin_tags-sessions","plugin_tags-woocommerce","plugin_category-ecommerce","plugin_category-performance","plugin_category-security-and-spam-protection","plugin_contributors-rynald0s","plugin_committers-rynald0s"],"banners":{"banner":"https:\/\/ps.w.org\/session-shredder-for-woocommerce\/assets\/banner-772x250.png?rev=3413052","banner_2x":false,"banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/session-shredder-for-woocommerce\/assets\/icon-256x256.png?rev=3413052","icon_2x":"https:\/\/ps.w.org\/session-shredder-for-woocommerce\/assets\/icon-256x256.png?rev=3413052","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Session Shredder is a production-grade, rule-based session cleanup plugin for WooCommerce 10.3+.<\/p>\n\n<p>WooCommerce 10.3 introduces experimental guest session storage and auto-pruning. Session Shredder builds directly on this already available foundation and adds behavior-based heuristics that predict which sessions are <strong>zombies<\/strong> (safe to prune) versus <strong>keepers<\/strong> (should be retained).<\/p>\n\n<p><strong>Highlights<\/strong><\/p>\n\n<p>\u2013 <strong>Heuristic pruning<\/strong> \u2013 Uses anonymized features (session age, pageviews, cart value, etc.) and conservative rules to identify low-value sessions.\n\u2013 <strong>Configurable rules &amp; thresholds<\/strong> \u2013 Tune base age, hard timeout, bounce detection, and cart-protection rules from a dedicated WooCommerce settings screen.\n\u2013 <strong>Safe thresholds<\/strong> \u2013 Only considers sessions past a base age window and is biased towards keeping anything that shows meaningful activity or cart value.\n\u2013 <strong>Robust behavior<\/strong> \u2013 Even if tracking data is sparse, a conservative rule-based strategy kicks in (e.g. hard 72h timeout, bounces with no cart value).\n\u2013 <strong>Privacy-first<\/strong> \u2013 No PII is stored. Session IDs and countries are hashed; only coarse behavioral data is used.\n\u2013 <strong>Native Woo 10.3 integration<\/strong> \u2013 Reads from the WooCommerce session table (supports both legacy and new tables) and plays nicely with the core experimental pruning.\n\u2013 <strong>HPOS compatible<\/strong> \u2013 Declares compatibility with WooCommerce High-Performance Order Storage (custom order tables) and never touches orders, only session data.\n\u2013 <strong>Admin dashboard<\/strong> \u2013 Under <strong>WooCommerce \u2192 Session Shredder<\/strong> you get active sessions, pruned counts, a Chart.js visualization of active &amp; pruned sessions per run, and a compact \"Recent runs\" summary.\n\u2013 <strong>Logging &amp; observability<\/strong> \u2013 Uses <code>wc_get_logger()<\/code> for info\/error logging; integrates cleanly with existing WooCommerce logs.<\/p>\n\n<p>Session Shredder is structured for real-world stores and designed as a companion to WooCommerce's experimental guest session engine. It stays fully rule-based out of the box, but developers can extend it via hooks if they ever want to plug in external scoring services or AI endpoints.<\/p>\n\n<p><strong>Why not rely only on the WooCommerce experimental pruning?<\/strong><\/p>\n\n<p>\u2013 Core experimental pruning is largely age-based and opaque.\n\u2013 Session Shredder adds behavior-aware rules (pageviews, cart value, bounce flag) on top of age.\n\u2013 You get a dry-run mode to analyze impact before deleting anything.\n\u2013 The dashboard gives you visibility into how many sessions were pruned per run and how many sessions remained active.\n\u2013 WP-CLI commands let you script and automate analyze\/prune runs.\n\u2013 It works alongside WooCommerce experimental guest sessions and HPOS rather than replacing them: Woo can still prune based on its own rules, while Session Shredder adds a tunable, rule-based layer with better reporting.<\/p>\n\n<h3>How It Works<\/h3>\n\n<ol>\n<li><p><strong>Feature collection<\/strong>\n\u2013 On each page load, Session Shredder tracks session activity:\n \u2013 Session age (hours since first seen)\n \u2013 Pageviews count\n \u2013 Cart value (numeric)\n \u2013 Whether anything was added to cart\n \u2013 Geolocation hash (hashed billing\/shipping country)\n \u2013 Simple bounce indicator (single pageview, no cart)\n\u2013 Features are stored per-session in non-autoloaded options and never include raw session IDs or user identifiers.<\/p><\/li>\n<li><p><strong>Rule-based pruning<\/strong>\n\u2013 An hourly cron (<code>session_shredder_cron<\/code>) scans the WooCommerce session table for candidates based on age.\n\u2013 For each candidate, the plugin:\n \u2013 Loads stored features\n \u2013 Applies conservative rules like:\n   \u2013 Session older than a hard timeout window (e.g. 72 hours)\n   \u2013 Single pageview and no cart value\n\u2013 If the rules deem the session a low-value \"zombie\", it is pruned.<\/p><\/li>\n<li><p><strong>Stats &amp; visualization<\/strong><\/p>\n\n<p>\u2013 After each real run, Session Shredder records:\n \u2013 Total pruned sessions (lifetime and today)\n \u2013 A short history of recent runs, including how many sessions were pruned and how many remained active before\/after each run\n\u2013 The admin dashboard renders a Chart.js line graph of active &amp; pruned sessions per run via a secure AJAX endpoint, plus a compact \"Recent runs\" table.<\/p><\/li>\n<\/ol>\n\n<h3>For developers<\/h3>\n\n<p>Session Shredder exposes a small set of hooks and CLI commands so you can integrate it into more advanced workflows without forking the plugin.<\/p>\n\n<h4>Hooks<\/h4>\n\n<p>\u2013 <code>session_shredder_features( array $features, string $session_hash )<\/code>\n  \u2013 Filter the behavior feature array before it is stored and later used for pruning decisions.\n  \u2013 <code>$session_hash<\/code> is a hashed identifier of the session (no raw IDs or PII).<\/p>\n\n<p>\u2013 <code>session_shredder_base_age_hours( float $base_age_hours )<\/code>\n  \u2013 Adjust the base age window (in hours) before sessions are considered as prune candidates.<\/p>\n\n<p>\u2013 <code>session_shredder_should_prune( bool $should_prune, array $features )<\/code>\n  \u2013 Override or refine the core rule-based decision for a given session.<\/p>\n\n<p>\u2013 <code>session_shredder_feature_options_soft_limit( int $soft_limit )<\/code>\n  \u2013 Adjust the soft cap for how many per-session feature options (<code>session_shredder_features_*<\/code>) are kept in <code>wp_options<\/code> before garbage collection trims the oldest entries.<\/p>\n\n<p>\u2013 <code>session_shredder_feature_options_gc_batch( int $batch_size )<\/code>\n  \u2013 Adjust how many feature options are removed per garbage-collection pass when the soft limit is exceeded. Larger values clean up faster; smaller values spread work over more runs.<\/p>\n\n<p>\u2013 <code>session_shredder_before_run( float $base_age_hours, bool $dry_run )<\/code>\n  \u2013 Fires before a prune run (cron, manual, or CLI) starts.<\/p>\n\n<p>\u2013 <code>session_shredder_after_run( int $pruned_count, bool $dry_run )<\/code>\n  \u2013 Fires after a prune run completes (dry-run or real).<\/p>\n\n<p>\u2013 <code>session_shredder_pruned( int $pruned_count )<\/code>\n  \u2013 Fires after a <strong>real<\/strong> prune run that actually deletes sessions; useful for logging or additional cleanup.<\/p>\n\n<h4>WP-CLI commands<\/h4>\n\n<p>If WP-CLI is available, Session Shredder registers the following commands:<\/p>\n\n<p>\u2013 <code>wp session-shredder analyze<\/code>\n  \u2013 Performs a dry run using the current rules and settings.\n  \u2013 Outputs the total number of sessions and how many <strong>would<\/strong> be pruned, without deleting anything.<\/p>\n\n<p>\u2013 <code>wp session-shredder prune<\/code>\n  \u2013 Runs a real prune using the current rules and settings.\n  \u2013 Deletes matching sessions, updates stats, and logs a summary.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>session-shredder<\/code> folder to <code>\/wp-content\/plugins\/<\/code>.<\/li>\n<li>Activate <strong>Session Shredder<\/strong> through the <strong>Plugins<\/strong> screen in WordPress.<\/li>\n<li>Ensure WooCommerce 10.3+ is active. If not, the plugin will display an admin notice and remain idle.<\/li>\n<li>(Optional) Extend the plugin via custom code and filters if you want to plug in your own external scoring service or additional heuristics.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id='will%20this%20delete%20active%20customer%20carts%3F'><h3>Will this delete active customer carts?<\/h3><\/dt>\n<dd><p>The plugin is deliberately conservative:<\/p>\n\n<p>\u2013 It operates only on sessions past a base age window (48 hours by default).\n\u2013 It uses features like cart value and pageviews to decide.<\/p>\n\n<p>No heuristic is perfect, but the design goal is <strong>fewer false prunes<\/strong> than WooCommerce core alone.<\/p><\/dd>\n<dt id='what%20data%20is%20stored%20by%20the%20plugin%3F'><h3>What data is stored by the plugin?<\/h3><\/dt>\n<dd><p>Only anonymized, behavioral features:<\/p>\n\n<p>\u2013 Age in hours\n\u2013 Pageviews count\n\u2013 Cart value (numeric)\n\u2013 Boolean flags (added_to_cart, bounce)<\/p>\n\n<p>No names, emails, raw IPs, or raw session IDs are stored by the plugin itself. It only works with coarse, behavior-level data such as age, pageviews, and cart totals.<\/p><\/dd>\n<dt id='how%20does%20this%20work%20with%20woocommerce%20experimental%20guest%20sessions%20and%20hpos%3F'><h3>How does this work with WooCommerce experimental guest sessions and HPOS?<\/h3><\/dt>\n<dd><p>Session Shredder is designed as a companion to WooCommerce 10.3+ experimental guest sessions:<\/p>\n\n<p>\u2013 On activation it opts your store into WooCommerce's experimental guest session storage if it is not already enabled.\n\u2013 It reads from the same session table(s) that WooCommerce uses and never touches orders or customer records.\n\u2013 WooCommerce core may still prune sessions based on its own rules; Session Shredder adds an additional, configurable rule-based layer on top.\n\u2013 The plugin declares compatibility with WooCommerce High-Performance Order Storage (custom order tables) and only operates on session data.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.1.0<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"Smart rule-based pruning for WooCommerce 10.3+. Enhances experimental session storage with behavior signals to remove zombie sessions and cut DB size.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/264948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=264948"}],"author":[{"embeddable":true,"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/rynald0s"}],"wp:attachment":[{"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=264948"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=264948"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=264948"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=264948"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=264948"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ewe.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=264948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}