Skip to content

feat: add approaching discounts to discount extension.#482

Open
sdedeo2025 wants to merge 4 commits into
Universal-Commerce-Protocol:mainfrom
sdedeo2025:feat/approaching_discount
Open

feat: add approaching discounts to discount extension.#482
sdedeo2025 wants to merge 4 commits into
Universal-Commerce-Protocol:mainfrom
sdedeo2025:feat/approaching_discount

Conversation

@sdedeo2025
Copy link
Copy Markdown

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.

 "discounts": {
        "approaching": {
            "cart": [
                {
                    "threshold": 10000,
                    "title": "$10 off orders over $100",
                    "total": 7500
                }
            ]
        }
    }

Design Decisions

  • Add on to the discount extension as approaching and applied discounts are tightly related.
  • Backwards compatible as this is a new section within the discount response and only returned when applicable.

Files

  • source/schemas/shopping/types/approaching_discount.json - Schema for the approaching discount object
  • source/schemas/shopping/discount.json - Modified schema to include approaching discount object within the discount object
  • docs/specification/approaching_discounts.md - Documentation with schema definitions and examples.
  • docs/specification/discount.md - Changes to include approaching discounts / link to approaching_discounts.md.

Category (Required)

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

NA

Checklist

  • I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

@sdedeo2025 sdedeo2025 requested review from a team as code owners May 27, 2026 14:00
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 27, 2026

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.

@sdedeo2025 sdedeo2025 changed the title Feat/approaching discount feat: add approaching discounts to discount extension. May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant