What
The template_selection checkout field submits its value as template_id in POST data, but the validation rule lookup used field['id'] (i.e. template_selection) directly. Since no validation rule exists under the key template_selection, the required check never fires — allowing checkout to proceed with no template selected.
Additionally, Rakit's required rule treats integer 0 as "present", so even a correctly-keyed rule would accept template_id=0. The fix adds min:1 for template_id specifically.
Also fixes the validation error label from "Template ID" → "Template Selection" for better UX.
Changes (uncommitted in worktree bugfix/template-validation)
- EDIT:
inc/checkout/class-checkout.php — add $field_to_rule_key map, use mapped key for rule lookup, add min:1 for template_id, fix label string
Acceptance Criteria
- Checkout with a required template selection field and no template chosen shows a validation error
template_id=0 is rejected when template_selection field has required attribute
- Validation error reads "Template Selection" not "Template ID"
Verification
# Manual: set a checkout form with required template_selection, submit without selecting
# Expected: validation error shown reading "Template Selection"
aidevops.sh v3.6.244 plugin for OpenCode v1.3.16 with claude-sonnet-4-6 spent 3m and 10,602 tokens on this as a headless worker.
What
The
template_selectioncheckout field submits its value astemplate_idin POST data, but the validation rule lookup usedfield['id'](i.e.template_selection) directly. Since no validation rule exists under the keytemplate_selection, therequiredcheck never fires — allowing checkout to proceed with no template selected.Additionally, Rakit's
requiredrule treats integer0as "present", so even a correctly-keyed rule would accepttemplate_id=0. The fix addsmin:1fortemplate_idspecifically.Also fixes the validation error label from "Template ID" → "Template Selection" for better UX.
Changes (uncommitted in worktree bugfix/template-validation)
inc/checkout/class-checkout.php— add$field_to_rule_keymap, use mapped key for rule lookup, addmin:1fortemplate_id, fix label stringAcceptance Criteria
template_id=0is rejected whentemplate_selectionfield hasrequiredattributeVerification
aidevops.sh v3.6.244 plugin for OpenCode v1.3.16 with claude-sonnet-4-6 spent 3m and 10,602 tokens on this as a headless worker.