Skip to content

feat: extend discount capability to cart#246

Open
igrigorik wants to merge 2 commits intomainfrom
feat/discounts-for-cart
Open

feat: extend discount capability to cart#246
igrigorik wants to merge 2 commits intomainfrom
feat/discounts-for-cart

Conversation

@igrigorik
Copy link
Contributor

We landed discount capability before cart and forgot to update discount capability. This PR fixes that:

  • Add dev.ucp.shopping.cart extension in discount schema (create/update)
  • Update discovery example to show cart + checkout extends
  • Add cart-to-checkout continuity requirement (MUST carry forward codes)
  • Add cart discount example to specification docs

Backwards compatible. It is up to the business whether they extend and support discounts on cart by using built-in extends mechanism on the capability, this change wires up the right schema shapes.


Checklist

  • New feature (non-breaking change which adds functionality)
  • Documentation update
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

  Discount previously only extended checkout, leaving cart without
  discount code support. This meant automatic discounts were invisible
  during cart exploration and agents couldn't show savings pre-checkout.

  - Add dev.ucp.shopping.cart extension in discount schema (create/update)
  - Update discovery example to show cart + checkout extends
  - Add cart-to-checkout continuity requirement (MUST carry forward codes)
  - Add cart discount example to specification docs
  Replace **Request:**/**Response:** markdown with === "Request"/=== "Response"
  tabbed format for consistency with cart-rest.md and checkout-rest.md.
@igrigorik igrigorik added this to the Working Draft milestone Mar 9, 2026
@igrigorik igrigorik self-assigned this Mar 9, 2026
@igrigorik igrigorik requested review from a team as code owners March 9, 2026 19:12
@igrigorik igrigorik added the TC review Ready for TC review label Mar 9, 2026
@igrigorik igrigorik requested review from mmohades and yanheChen March 9, 2026 19:12
- Discount amounts reflected in `totals[]` and `line_items[].discount`

**Cart-to-checkout continuity:** When a cart is converted to a checkout via the
cart capability's `cart_id` field, businesses MUST carry forward any discount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a sort of state-management requirement for implementations. Do we need to add explicit guidance on how to handle codes that might become invalid during that transition (e.g., a code that works for "Cart Exploration" but is restricted during "Checkout") e.g first time user discount code shown at cart time, which is invalid when the user signs in and merchant finds out that the user is an existing user?


### Cart with discount codes

Discount codes applied during cart exploration. The cart response includes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema uses the same applied_discount object for both Cart (estimated) and Checkout (final).Do we need something in the documentation to clarify that cart-level discounts are non-binding/provisional, whereas checkout-level discounts are typically locked in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TC review Ready for TC review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants