Support for weight-based and unit-of-measure quantities in line items #221
Replies: 1 comment
-
|
Excellent write-up. This is a foundational gap — you can't represent a grocery cart with the current schema, and with Kroger, Walmart, and Carrefour as UCP partners, this will become a blocker fast. Worth noting ACP has the same limitation ( I've looked at how the major commerce standards handle this, and there's strong convergence on a pattern: Industry precedent:
The key design principle from both Schema.org and Shopify: separate "what you buy" from "how it's priced." Shopify's model makes this explicit — On the three options: I'd go with Option B (extension), for three concrete reasons:
Suggested extension shape: Drawing from the Shopify/GMC model: {
\"measured_quantity\": {
\"value\": 2.5,
\"unit\": \"lb\",
\"type\": \"weight\"
},
\"price_measurement\": {
\"unit\": \"lb\",
\"reference_value\": 1
},
\"quantity_status\": \"estimated\"
}
On use case #5 (estimated → actual): This is the hardest part and probably deserves its own follow-up discussion. The estimated→actual reconciliation touches the order lifecycle ( |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
The current line_item.json schema defines quantity as an integer with a minimum of 1, and item.json defines price as a fixed unit price. This works for discrete products (1 shirt, 2 phones) but doesn't support products sold by weight or other units of measure, which is a fundamental requirement for grocery, deli, bulk goods, and hardware.
Examples that can't be represented today:
This is relevant given that Kroger, Walmart, and Carrefour, all with significant grocery operations, are UCP partners.
Current Schema Limitation
In line_item.json, quantity is defined as an integer so it cannot express something like 2.5 lbs. In item.json, price is a flat integer with no unit context, so there is no way to indicate whether the price is per lb, per kg, or per each.
Possible Approaches
Option A: Extend item and line_item schemas directly
Add optional fields to the existing schemas. For example, a price_unit field on item.json indicating the unit of measure for pricing (open string with well-known values like each, lb, kg, oz, g, l, ml, m, ft, yd, defaulting to each). And on line_item.json, a measured_quantity field (number type instead of integer) along with a measured_unit field for weight/measure-based items.
Option B: Extension schema (non-breaking)
Create a dev.ucp.shopping.weighted_items extension following the discount/fee pattern, keeping the base schemas untouched.
Option C: Vendor extension first
A vendor ships this under their own namespace (for example com.kroger.weighted_items) to validate the design before proposing it as a dev.ucp capability.
Use Cases
Questions for the Community
Beta Was this translation helpful? Give feedback.
All reactions