feat(shopping): Add additional fields proposal (from Shopify)#481
feat(shopping): Add additional fields proposal (from Shopify)#481SaifBenChahed wants to merge 5 commits into
Conversation
0f3f644 to
7ddded6
Compare
7ddded6 to
d89904f
Compare
jamesandersen
left a comment
There was a problem hiding this comment.
@SaifBenChahed thanks for submitting this! I think this will unlock agentic commerce for a non-trivial cohort of merchants requiring some incidental extra inputs.
| "ucp_request": "omit" | ||
| }, | ||
| "value": { | ||
| "type": [ |
There was a problem hiding this comment.
Just a thought, for booleans, might consider making the base value accept a union, then use the same if/then pattern the PR already uses for input to pin boolean-typed fields to a real boolean:
// additional_field.value base type:
"value": { "type": ["string", "boolean", "null"], ... }
// additional_field.allOf — add:
{
"if": {
"properties": { "input": { "properties": { "type": { "const": "boolean" } }, "required": ["type"] } },
"required": ["input"]
},
"then": { "properties": { "value": { "type": ["boolean", "null"] } } }
}
Request becomes { "key": "gift_wrap", "value": true }, cleared as { "key": "gift_wrap", "value": null }.
Otherwise I'd just add some language indicated the expected string formats for boolean values
There was a problem hiding this comment.
Thanks, that makes sense. The conditional schema approach would work well for responses, since each field includes input.type.
For submissions, though, we only send key + value, without the field definition. The business still needs to resolve the key back to its field definition to validate type-specific rules, whether that rule is boolean format, choice membership, date bounds, or text constraints.
My slight preference is to keep value as string | null here for a uniform submission shape, so I added normative language that non-null boolean values MUST be the exact strings "true" or "false".
There was a problem hiding this comment.
While there's a preference for machine resolvable schema, this seems reasonable; we'll see if there's any second opinion here ;-)
Summary
Adds an Additional Fields proposal using a single extension with optional config-based type narrowing.
Businesses sometimes need to collect checkout data that is specific to their workflow, such as PO numbers, gift options, delivery notes, requested dates, or buyer acknowledgements. Today there is no standard way for a business to describe those fields to a platform, for the platform to collect values, or for captured values to appear on orders.
This proposal standardizes that exchange:
additional_fieldsdefinitions and submitted valuestext,boolean,date, andchoicemessages[]It also adds optional
config.supported_typeson the capability. Platforms and businesses may usesupported_typesto narrow the active type set; when both declare it, the active set is their intersection.Notes
The payload schema remains the full standard type superset. Config is treated as an optional negotiation constraint, not the primary extension model.