WOOF - WooCommerce Products Filter

How to save a selected filter in a session so the website keeps it remembered for the user

Works from v.1.1.6/2.1.6. PHP 5.4 is minimum requirement.

Drop the next script example in the functions.php file of the current wp theme:

add_filter('send_headers', function() {
        if ($_SERVER['SCRIPT_URL'] === '/' OR $_SERVER['SCRIPT_URL'] === '/shop/')
        {
            global $WOOF;
            if (!$WOOF->is_isset_in_request_data($WOOF->get_swoof_search_slug()))
            {
                $woof_last_search_request = $WOOF->storage->get_val('woof_last_search_request');
                if (!empty($woof_last_search_request) AND is_array($woof_last_search_request))
                {
                    unset($woof_last_search_request['wc-ajax']);
                    unset($woof_last_search_request['page']);
                    unset($woof_last_search_request['paged']);
                    //***
                    $_GET = $woof_last_search_request;
                    add_filter('woof_get_request_data', function() use($woof_last_search_request) {
                        return $woof_last_search_request;
                    });
                }
            }
        }
    }, 9999);