DataViews: declare Status field elements + sort on status key#26
Merged
Conversation
Small hygiene pass on the Recent AI Orders table's Status column. Zero visual change, two concrete improvements: 1. Declare the status field's `elements` — the closed enum of valid WC order statuses (processing, completed, on-hold, pending, cancelled, refunded, failed). DataViews treats element-typed fields as first-class: future filter UI would auto-populate a dropdown from this list instead of requiring a manual filter component, and the declaration documents the valid value set at the field definition site rather than in the StatusPill component's color map. 2. Sort on the status key (`item.status`) rather than the localized label. Makes the sort stable across locales — an English store and a French store produce the same sort sequence on the Status column click, because the underlying key doesn't change with translation. The display label stays the same. Labels use the `woocommerce` text domain so they inherit WC core's own translations. A merchant running a translated store sees the same "En cours" / "処理中" / etc. that appears on the native Orders list — no duplicate translation work. PHPCS `WordPress.WP.I18n.TextDomainMismatch` is suppressed per-line because this is deliberate cross-plugin label sharing, standard pattern for plugins integrating with WC's data model. Part of the DataViews migration series; see AGENTS.md "Styling" for the adoption recipe this builds on. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Small hygiene pass on the Recent AI Orders table's Status column. Zero visual change, two concrete improvements:
elements— the closed enum of valid WC statuses (processing,completed,on-hold,pending,cancelled,refunded,failed). DataViews treats element-typed fields as first-class: future filter UI auto-populates a dropdown from this list, and the enum is documented at the field definition site rather than hidden in the StatusPill color map.Translation strategy
Labels use the
woocommercetext domain so they inherit WC core's own translations. A merchant on a translated store sees the same "En cours" / "処理中" that appears on the native Orders list — no duplicate translation work. PHPCSWordPress.WP.I18n.TextDomainMismatchsuppressed per-line because this is deliberate cross-plugin label sharing (standard pattern for plugins integrating with WC's data model).Test plan
.potregeneratedShips as
Merged to
main, not tagged. Queues behind the next release signal — now 6 PRs past v1.6.7.🤖 Generated with Claude Code