feat(schema): add inventory signals to variant availability#403
Open
hemanth wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
Open
feat(schema): add inventory signals to variant availability#403hemanth wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
hemanth wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
Conversation
Extends the existing availability object on variants with optional inventory fields: quantity, low_stock_threshold, restock_at, and per-location availability. All fields are optional — businesses that don't track inventory simply omit them. The existing available boolean and status enum remain unchanged. Closes Universal-Commerce-Protocol#345
|
This is a great addition. From building BuyWhere (a product search API across SEA marketplaces), we found that inventory signals are one of the most critical data points for AI agents making purchase decisions. A few data points from our experience:
One thing worth considering: should the spec include a “lock” mechanism for cart-level inventory? Some marketplaces reserve inventory for minutes after add-to-cart, which is important for agents doing multi-step checkout flows. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now, variant availability is a boolean plus an enum. You know if something is available, and roughly what state it is in (in_stock, backorder, etc). But that is about it.
For agents doing the talking -- especially voice agents where you can not show a grid of alternatives -- "available" vs "unavailable" is not enough. "Only 2 left" changes buying behavior. "Back in stock next Tuesday" changes whether the buyer waits or goes elsewhere.
This PR extends the existing
availabilityobject on variants with optional inventory fields. Nothing breaks, nothing is required, businesses that do not track inventory just skip the new fields.Closes #345
What changed
One file:
source/schemas/shopping/types/variant.jsonThe
availabilityobject gets four new optional properties:quantity(integer) -- current stock count. Some businesses will share this, others will not. Both are fine.low_stock_threshold(integer) -- the business defines what "low stock" means to them. Platforms can use this to show "almost gone" or similar messaging.restock_at(date-time) -- estimated restock date for out-of-stock or backordered items. Useful for "check back on Tuesday" type conversations.locations(array) -- per-location availability for multi-location businesses. Each location has an id, name, available flag, optional quantity, and status.The existing
availableboolean andstatusenum are untouched.What it looks like
{ "id": "variant_mug_blue", "title": "Ceramic Mug - Blue", "availability": { "available": true, "status": "in_stock", "quantity": 4, "low_stock_threshold": 5, "restock_at": "2026-05-10T00:00:00Z", "locations": [ { "id": "loc_downtown", "name": "Downtown", "available": true, "quantity": 3 }, { "id": "loc_online", "name": "Online", "available": true, "quantity": 1 } ] } }A business that does not track inventory still returns what they always returned:
{ "availability": { "available": true, "status": "in_stock" } }No change needed on their side.
Why this matters for agents
A voice agent can not show a product grid. The conversation is linear, so the agent needs to make good recommendations with the information it has. Knowing stock levels lets it say things like:
Without these signals, the agent is stuck with "it is available" or "it is not available." That is a worse experience for the buyer.