You will need to modify the search form to save the search criteria as a cookie or you can use a session storage instead of cookies. you would add in your current themes js folder something like this:
mytheme/js/custom-script.js
and add the following code:
document.addEventListener('DOMContentLoaded', function() { var searchForm = document.querySelector('.search-filter-wrap form'); if (searchForm) { searchForm.addEventListener('submit', function() { var keywords = document.querySelector('input[name="search_keywords"]').value; var location = document.querySelector('input[name="search_location"]') ? document.querySelector('input[name="search_location"]').value : ''; var region = document.querySelector('select[name="search_region"]') ? document.querySelector('select[name="search_region"]').value : ''; sessionStorage.setItem('search_keywords', keywords); sessionStorage.setItem('search_location', location); sessionStorage.setItem('search_region', region); }); if (sessionStorage.getItem('search_keywords')) { document.querySelector('input[name="search_keywords"]').value = sessionStorage.getItem('search_keywords'); } if (sessionStorage.getItem('search_location')) { document.querySelector('input[name="search_location"]').value = sessionStorage.getItem('search_location'); } if (sessionStorage.getItem('search_region')) { document.querySelector('select[name="search_region"]').value = sessionStorage.getItem('search_region'); } } });
I have not tested this so it’s best to do this in a dev or staging environment.