A browser extension that displays return cost information on Amazon product pages for US (amazon.com) and Germany (amazon.de).
Works in:
- Chrome, Edge, and other Chromium-based browsers
- Firefox (version 109+)
Requires Manifest V3 support (Chrome 109+, Firefox 109+).
- Displays return costs for both defective/damaged items and regular returns
- Supports Amazon.com (US) and Amazon.de (Germany)
- Multi-language support (English & German)
- Detects third-party sellers and fetches their return policies
- Caches seller policies to reduce repeated fetches
- Clean, non-intrusive UI that matches Amazon's design
- Install dependencies:
yarn install- Build the extension:
yarn build- Load the extension:
Chrome/Edge:
- Navigate to
chrome://extensions(Chrome) oredge://extensions(Edge) - Enable "Developer mode" (toggle in top right)
- Click "Load unpacked"
- Select the
dist/folder from this project
Firefox:
- Navigate to
about:debugging#/runtime/this-firefox - Click "Load Temporary Add-on"
- Select the
dist/manifest.jsonfile - Note: Temporary add-ons in Firefox are removed when the browser closes
To automatically rebuild on file changes:
yarn devAfter making changes, reload the extension in chrome://extensions and refresh the Amazon product page.
yarn test # Run all tests
yarn test:watch # Watch mode
yarn test:coverage # With coverage report50 tests covering:
- Policy scraping (Amazon.com and Amazon.de)
- Seller detection
- Internationalization (i18n)
- Edge cases (restocking fees, non-returnable items, paid shipping)
yarn test:extensionAutomated integration test:
- Launches Chrome with the extension loaded
- Navigates to a real Amazon.de product page
- Waits for the widget to appear
- Validates widget content
- Takes a screenshot (
/tmp/extension-test-screenshot.jpg) - Keeps browser open for 10 seconds for inspection
Expected output:
π Extension test PASSED!
β Defective section: β
β Regular section: β
β Cost information: β
# Test with default URLs
yarn test:dynamic
# Test any Amazon product page
yarn node test-dynamic.js "https://www.amazon.de/dp/PRODUCT_ID"
# Examples
yarn node test-dynamic.js "https://www.amazon.com/dp/B0D1XD1ZV3"
yarn node test-dynamic.js "https://www.amazon.de/dp/B0BNQ66ZN1"Features:
- β Test any Amazon product URL dynamically
- β Multiple test cases in one run
- β Validates widget content automatically
- β Screenshots saved for each test
- β Detailed console logs and extension logs
- β Pass/fail summary report
See TEST_USAGE.md for detailed testing guide.
-
Visit Amazon product pages:
-
Look for the "Return Cost Information" widget near the buy box
-
Test cases to verify:
- Products with "FREE Returns" badge (should show free for both)
- Products without "FREE Returns" badge (should show β¬6.50-β¬13.00 for regular returns)
- Products sold by third-party sellers
- Different product categories
- Both amazon.com and amazon.de domains
src/
βββ content/
β βββ content.ts # Main orchestrator
β βββ policyScraper.ts # Product page policy extraction
β βββ sellerScraper.ts # Third-party seller detection & scraping
β βββ ui.ts # Widget creation and injection
β βββ styles.css # Widget styles
βββ shared/
β βββ types.ts # TypeScript interfaces
β βββ regionDetector.ts # Amazon domain detection
β βββ policyData.ts # Static policy guidelines
β βββ i18n.ts # Language patterns & UI text
βββ manifest.json # Chrome extension manifest
- Detects Amazon region (amazon.com or amazon.de) and language
- Checks if the seller is Amazon or a third-party seller
- For third-party sellers: Fetches and parses their return policy from their seller details page
- For Amazon-sold items: Scrapes return policy from product page
- Paid Shipping Detection (Amazon.de):
- Defective items: Always free per EU consumer law
- Regular returns: Free only if "FREE Returns" badge is present
- Without badge: Shows β¬6.50-β¬13.00 shipping cost (customer pays)
- Falls back to default regional policies if scraping fails
- Displays the information in a clean, color-coded widget
- Caches third-party seller policies for 7 days to improve performance
- β Always free return shipping (EU consumer law requirement)
- β 14-day return window
- β With "FREE Returns" badge: Free shipping, 14 days
β οΈ Without "FREE Returns" badge: β¬6.50-β¬13.00 shipping cost, 14 days- βΉοΈ The extension detects the absence of the badge and displays the cost
ββββββββββββββββββββββββββββββββββββ
β RΓΌcksendekosten-Informationen β
ββββββββββββββββββββββββββββββββββββ€
β Defekte/BeschΓ€digte Artikel: β
β Kostenlose RΓΌcksendung innerhalb β β Green
β von 14 Tagen β
β β
β RegulΓ€re RΓΌcksendungen: β
β Nicht kostenlose RΓΌcksendung β β Red/Orange
β (β¬6.50-β¬13.00 Kosten) β
β innerhalb von 14 Tagen β
β β
β β¬ Basierend auf Amazons β
β RΓΌckgaberichtlinie β
ββββββββββββββββββββββββββββββββββββ
- TypeScript
- Webpack 5
- Browser Extension Manifest V3
- WebExtension Polyfill (cross-browser compatibility)
- Vanilla JavaScript (no frameworks)
- United States (amazon.com) - English
- Germany (amazon.de) - German
The extension uses webextension-polyfill to ensure consistent behavior across Chrome, Edge, and Firefox:
- Single codebase: Same code works in all browsers
- Unified API: Uses standard
browser.*namespace (polyfill translates tochrome.*in Chromium browsers) - No browser-specific code: All functionality works identically across browsers
- Single build: The
dist/folder works for all browsers without modification
Technical details:
- Chrome uses callback-based
chrome.*API - Firefox uses promise-based
browser.*API - WebExtension polyfill provides unified promise-based
browser.*API for both - Manifest V3 is fully supported in Chrome 109+ and Firefox 109+
See .claude/CHROME_EXTENSION_TESTING.md for comprehensive testing guide.
MIT