- 01 March 2025
- Fixed a page loop on adding additional search filters
- 20 February 2025
- It works now. Swapped popstate for MutationObserver
May 30, 2024 at 09:53
Updated: 20 Feb 2025.
This topic was previously covered in the Firefox Modifications post, but this solution is much more convenient. By appending “&rh=p_85%3A2470955011” to the Amazon search URL, you can ensure that your search results always display Prime-eligible items. The parameter p_85 stands for “Amazon Prime,” and 2470955011 is the Prime filter identifier.
Here is a Tampermonkey script that automates this process for you. When you search, the page will reload with the Prime filter applied. This will add a second or two to your search time, but it’s likely something you would manually do anyway.
always_prime_search.js
// ==UserScript==
// @name Amazon Prime Search Modifier
// @namespace http://tampermonkey.net/
// @version 1.4
// @description Automatically add Prime filter to Amazon search URLs using URLSearchParams
// @author Johnny Quest
// @match https://www.amazon.com/s*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const primeFilterParam = 'p_85:2470955011';
function modifySearchURL() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
let rh = params.get('rh') || '';
// Check if the prime filter is already present
if (!rh.includes(primeFilterParam)) {
// Append the prime filter; if there are other filters, separate them with a comma
rh = rh ? `${rh},${primeFilterParam}` : primeFilterParam;
params.set('rh', rh);
url.search = params.toString();
// Replace the URL with the new parameters
window.location.replace(url.toString());
}
}
// Run the function on load. Optionally, you can attach this to events if needed.
modifySearchURL();
})();
Questions or comments?