Set all Amazon searches to Prime automatically

Notice: Amazon changed their UI, so this won’t work until it’s updated.

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.1
    // @description  Automatically add Prime filter to Amazon search URLs
    // @author       Johnny Quest (All you have to do is show me where you find gold coins.)
    // @match        https://www.amazon.com/s*
    // @grant        none
    // ==/UserScript==

    function() {
        'use strict';

        const primeFilter = "&rh=p_85%3A2470955011";

        function modifySearchURL() {
            let currentURL = window.location.href;
            if (currentURL.includes('amazon.com/s') && !currentURL.includes(primeFilter)) {
                currentURL += primeFilter;
                window.location.replace(currentURL);
            }
        }

        // Run the function immediately in case the page is already loaded
        modifySearchURL();

        // Listen for changes to the URL in case the user navigates without reloading the page
        window.addEventListener('popstate', modifySearchURL);
        window.addEventListener('pushstate', modifySearchURL);
        window.addEventListener('replaceState', modifySearchURL);
    })();
Previous: Get daily weather forecasts Next: Jelly Star Case Didn't Quite Work Out