feat: add approaching discounts to discount extension.#482
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Design question: should approaching discounts live in a new First — really glad to see this. Approaching-discount messaging is high-leverage for conversion and AOV, and the schema is clean. Before we land it under The concern with placing it in the discount extension The discount capability today is consistent about one thing: it represents money that has moved — amounts, allocations, methods, eligibility for adjustments that are actually applied. Approaching discounts are a different kind of object: no money has changed, nothing is allocated, and the buyer hasn't done anything yet. It's a marketing/upsell signal about a possible future state. The shape generalizes naturally to other upsell signals merchants already run today:
None of those are discounts, but they all share the same structure: here is a threshold, here is where you are, here is the message. If we put approaching discounts under There's also a coupling cost: businesses can't advertise upsell-messaging support without claiming the full discount surface, and any change to upsell semantics churns the discount extension's version. Proposal A new extension — "incentives": {
"approaching_discounts": [
{ "title": "...", "remaining": 2500, "scope": {...} }
]
// future: free_gifts, samples, bogo_triggers, loyalty_progress
}Why this fits cleanly with identity linking This is actually the strongest argument for the split. Incentives are deeply identity-aware:
A separate extension can define its own scope ( Folding it into Two smaller things on the current schema (worth addressing either way)
Honest take If the appetite is "ship now, refactor when the second upsell shape arrives," the PR is fine as-is — the field is additive and |
Description
Updates the Discount extension (
dev.ucp.shopping.discount) to support returning details of approaching discounts.Approaching discounts enables buyers to be informed when they are approaching a cart ($10 off orders >= $100) or shipping discount (free shipping on orders >= $100).
Approaching discounts are for promotions that trigger based on a qualifying amount and contain an upsell threshold, enabling the merchant to specify when the approaching discount message is shown to the buyer.
How it works
Cart
Expanding on the above example, $10 off orders >= $100, the qualifying amount is $100. If the upsell threshold is set to $25, the message will be returned once the cart exceeds $75 in value (but less than $100 when the promotion applies).
Shipping
Similarly, shipping approaching discounts are used to convey discounted or free shipping. Shipping approaching discounts are calculated based on the amount of qualifying products within the fulfillment group.
i.e. Free shipping on orders >= $100, upsell threshold $25
Schema
The approaching discounts are returned as part of the discount object in the cart and checkout response. Example below.
Design Decisions
Files
Category (Required)
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Related Issues
NA
Checklist
!for breaking changes).