-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Background
Caramel already knows coupon codes for 5 000+ stores, but only 4 of those stores (Amazon, eBay, Codecademy, Best Buy) get their codes auto-applied in the checkout. The logic that drives this lives in two places:
supported.json— maps a store’s domain to the CSS selectors we need.- Optional custom JS — for edge cases (see
amazon.jsbelow).
// Example custom logic — apps/caramel-extension/stores/amazon.js
(() => {
window.getAmazonOrderTotal = async () => {
const totalEl = document.querySelector(
'#sc-subtotal-amount-buybox .a-size-medium.a-color-base'
)
if (!totalEl) return '0.00'
return totalEl.innerText.replace(/[^0-9.]/g, '') || '0.00'
}
})()What to Do
-
Pick a store
Browse our [supported sites list](https://grabcaramel.com/supported-sites) and choose one not already insupported.json. -
Find the selectors
couponInput– the<input>where a promo code goes.couponSubmit– the button that applies the code.priceContainer– an element that shows the order total.- Optional extras:
showInputif the input is hidden behind a link or accordion.dismissButtonfor closing modals that block the page.
-
Add an entry
Updatesupported.jsonwith a new object for your store. -
Need custom logic?
Some sites require a helper to read the order total, wait for DOM updates, etc. If so:- Create
apps/caramel-extension/stores/<store>.js. - Export functions on
windowlike the Amazon example.
- Create
-
Test locally
- Run the extension in your browser’s developer mode.
- Verify that Caramel auto-inserts a working coupon (or at least tries).
- Check the console for errors.
-
Open a PR
- Title:
feat: add <store> support - Link this issue.
- Describe what you added and how you tested.
- Title:
Acceptance Checklist
-
supported.jsonentry with correct selectors - Optional custom script placed under
stores/ - Manual test passes (coupon input appears, no console errors)
- PR follows our code style (
pnpm lint/prettieris green)
Tips
- If a store uses iframes, try
document.querySelectorinside the frame’scontentDocument. - For dynamic sites,
MutationObservercan be your friend. Drop a helper in the custom script if needed. - Keep selector strings as narrow as possible to avoid false positives.
Happy hacking! Feel free to ask questions in the comments or on our Discord.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers