{"id":97,"date":"2025-05-14T16:13:52","date_gmt":"2025-05-14T16:13:52","guid":{"rendered":"https:\/\/8p8c.org\/?page_id=97"},"modified":"2025-05-17T07:19:58","modified_gmt":"2025-05-17T07:19:58","slug":"ebay-default-filters-tampermonkey-script","status":"publish","type":"page","link":"https:\/\/8p8c.org\/?page_id=97","title":{"rendered":"eBay Default Filters Tampermonkey Script"},"content":{"rendered":"\n<p><strong>WARNING: DO NOT USE eBay WILL LOCK YOUR ACCOUNT.<\/strong><\/p>\n\n\n\n<p>USE &#8220;Advanced Search&#8221; INSTEAD!<\/p>\n\n\n\n<p>If you are a regular eBay user &#8211; this is soooo frustrating &#8211; when eBay will not save filter settings &#8211; yes there is an &#8220;app&#8221; I am talking about real proper software! This will save your filters &#8211; no more endless entries from inaccessible countries that won&#8217;t deliver!<\/p>\n\n\n\n<p>Download and install Tampermonkey for your browser.<\/p>\n\n\n\n<p>This Tampermonkey script automatically applies default filters to eBay search pages, including item condition (new), free shipping, items located in your country, and sorting by lowest price plus shipping (P&amp;P). Below is the explanation and the complete script.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Explanation<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Purpose<\/strong>: The script modifies the eBay search URL to include specific filters when a search page loads.<\/li>\n\n\n\n<li><strong>Filters Applied<\/strong>:\n<ul class=\"wp-block-list\">\n<li><code>LH_ItemCondition=1000<\/code>: Filters for new items.<\/li>\n\n\n\n<li><code>LH_ShippedFree=1<\/code>: Filters for items with free shipping.<\/li>\n\n\n\n<li><code>LH_LocatedIn=1<\/code>: Filters for items located in your country.<\/li>\n\n\n\n<li><code>_sop=15<\/code>: Sorts results by lowest price plus shipping (P&amp;P).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Logic<\/strong>:\n<ul class=\"wp-block-list\">\n<li>The script checks if each filter is already present in the URL to avoid duplication.<\/li>\n\n\n\n<li>If any filter is missing, it appends the filter to the URL and navigates to the updated URL.<\/li>\n\n\n\n<li>Navigation only occurs if changes are made to prevent infinite reloads.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Event Trigger<\/strong>: The script runs when the page fully loads, using the <code>load<\/code> event listener.<\/li>\n\n\n\n<li><strong>Error Handling<\/strong>: Errors during execution are logged to the console for debugging.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Code<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ ==UserScript==\n\/\/ @name         eBay Default Filters\n\/\/ @namespace    http:\/\/tampermonkey.net\/\n\/\/ @version      0.2\n\/\/ @description  Automatically apply default filters on eBay, including sort by lowest price + P&amp;P\n\/\/ @author       You\n\/\/ @match        https:\/\/www.ebay.com\/sch\/*\n\/\/ @grant        none\n\/\/ ==\/UserScript==\n\n(function() {\n    'use strict';\n\n    \/\/ Function to apply filters\n    function applyFilters() {\n        try {\n            \/\/ Example filters\n            const locationFilter = 'LH_ItemCondition=1000'; \/\/ New items\n            const shippingFilter = 'LH_ShippedFree=1'; \/\/ Free shipping\n            const location = 'LH_LocatedIn=1'; \/\/ Items located in your country\n            const sortFilter = '_sop=15'; \/\/ Sort by lowest price + shipping\n\n            \/\/ Get the current URL\n            let url = new URL(window.location.href);\n\n            \/\/ Add filters to the URL if they aren't already present\n            if (!url.searchParams.has('LH_ItemCondition')) {\n                url.searchParams.append('LH_ItemCondition', '1000');\n            }\n            if (!url.searchParams.has('LH_ShippedFree')) {\n                url.searchParams.append('LH_ShippedFree', '1');\n            }\n            if (!url.searchParams.has('LH_LocatedIn')) {\n                url.searchParams.append('LH_LocatedIn', '1');\n            }\n            if (!url.searchParams.has('_sop')) {\n                url.searchParams.append('_sop', '15');\n            }\n\n            \/\/ Only navigate if filters were added to avoid infinite reloads\n            if (url.toString() !== window.location.href) {\n                window.location.href = url.toString();\n            }\n        } catch (error) {\n            console.error('Error applying filters:', error);\n        }\n    }\n\n    \/\/ Apply filters when the page loads\n    window.addEventListener('load', applyFilters);\n})();\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">How It Works<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The script runs on eBay search pages (<code>https:\/\/www.ebay.com\/sch\/*<\/code>).<\/li>\n\n\n\n<li>It constructs a new URL with the specified filters if they are not already present.<\/li>\n\n\n\n<li>If the URL changes (i.e., new filters are added), the page navigates to the updated URL.<\/li>\n\n\n\n<li>The script ensures no infinite reloads by checking for existing filters and only navigating when necessary.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>_sop=15<\/code> parameter sorts by &#8220;Price + Shipping: lowest first&#8221; on eBay.<\/li>\n\n\n\n<li>The script uses the <code>URL<\/code> API to manipulate query parameters safely.<\/li>\n\n\n\n<li>Tested as of May 14, 2025, on eBay search pages.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Update<\/h2>\n\n\n\n<p>eBay uses very aggressive bot detection, and this results in the constant reset of the parameters to set &#8220;Lowest Price + P&amp;P first&#8221; as the search mode. Ask yourself why that would be?<\/p>\n\n\n\n<p>Because of this &#8211; the selection is overridden, the Country code is non-scripted, so it works, all other attempts at any kind of default setting that ISN&#8217;T &#8220;Best Match&#8221; is detected and stopped at site level, they really really want you to see &#8220;Best Match&#8221;. If you know anything about how the &#8220;Best Match&#8221; is achieved &#8211; you&#8217;ll know why.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Further Update<\/h2>\n\n\n\n<p>If you do use the method above your account WILL be locked. eBay are an aggressive corporatist company, and my opinion is they are on their way out.<\/p>\n\n\n\n<p>I will be choosing alternative sites to purchase from, as this level of aggressive behaviour is intolerable &#8211; coupled with a serious downturn in quality of service and in the site generally.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WARNING: DO NOT USE eBay WILL LOCK YOUR ACCOUNT. USE &#8220;Advanced Search&#8221; INSTEAD! If you are a regular eBay user &#8211; this is soooo frustrating &#8211; when eBay will not save filter settings &#8211; yes there is an &#8220;app&#8221; I am talking about real proper software! This will save your filters &#8211; no more endless [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-97","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/pages\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/8p8c.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":5,"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/pages\/97\/revisions"}],"predecessor-version":[{"id":104,"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/pages\/97\/revisions\/104"}],"wp:attachment":[{"href":"https:\/\/8p8c.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}