ShopTools AI can test available codes in supported carts. For anyone building such a tool, the key distinction is simple: failing to find a coupon field is acceptable; typing into payment or contact fields is not.

The following is a proposed defensive detection approach. It is neither a universal selector nor a statement of ShopTools' exact ranking weights or supported merchants.
Exclude unsafe candidates first
Start with text elements that can actually accept input. Hidden, disabled and read-only fields are not suitable for an attempt. Check an input's purpose as well as its type; neither alone establishes that it is a coupon field.
Exclude passwords, email, phone, address, payment details, search and order comments before ranking. A nearby discount-related word must not override that exclusion.
Combine independent contextual clues
For remaining candidates, inspect names, IDs, placeholders, accessible labels, associated labels and the surrounding container. Words such as promo, coupon and voucher are clues, not proof; language and markup vary.
Known selectors can be combined with cautious contextual ranking. Even a selector match needs element-level validation because merchant markup may have changed.
Treat gift cards separately. An input for a stored balance or card number is not automatically a general coupon field. When the distinction is unclear, leave the action to the person or use a tested merchant-specific adapter.
Validate reveal controls and apply buttons separately
For a hidden field, look for a control clearly associated with revealing it. A Continue label proves nothing. Controls that place orders, sign in or navigate elsewhere are not suitable.
After revealing the field, run a bounded search again. Previously captured DOM references may no longer be valid if the merchant replaced part of the form.
Evaluate the apply button independently. Finding the correct field does not make an adjacent submit button safe. Payment, purchase or order-confirmation signals should rule out an automated click.
Build tests around dangerous neighbors
- Place coupon, email and gift-card inputs beside Pay. Only a validated coupon-field and action pair may be used.
- Keep a plausible label but change the element's purpose; the detector should refuse it.
- Hide the field behind a reveal control, then replace the container after opening it.
- Provide several plausible candidates and check that uncertainty stops the action.
Useful diagnostics distinguish a missing field, a missing safe button and an ambiguous match. Sending form contents is unnecessary for this distinction; even technical signals should be bounded in advance.
To measure false positives, divide fixtures with no valid field where the detector still selects one by all such negative fixtures. Compare the same labeled set before and after a change.
Count wrongly selected sensitive inputs separately from missed coupon fields and missing safe buttons. Otherwise a single detection score can hide the most dangerous error.
This design still needs testing against specific markup. A high field-detection count cannot compensate for a dangerous false positive. An explicit refusal is preferable to a speculative action beside payment controls.
By the ShopTools AI editorial team.
Some ShopTools links are affiliate links. ShopTools may earn a commission on a qualifying purchase confirmed by the retailer; a click alone does not guarantee a commission.
Prepared with AI assistance. Product descriptions were checked against ShopTools code and interface; this is not a report of tests at every store.