Skip to content

fix(plugin-ecommerce): use plugin-ecommerce namespace for variant options validation messages - #19027

Open
lazerg wants to merge 1 commit into
payloadcms:mainfrom
lazerg:fix/issue-19021-variant-options-translation-keys
Open

lazerg wants to merge 1 commit into
payloadcms:mainfrom
lazerg:fix/issue-19021-variant-options-translation-keys

Conversation

@lazerg

@lazerg lazerg commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What?

Variant options validation messages now use the plugin-ecommerce translation namespace.

Why?

validateOptions called t('ecommerce:…'), but the plugin registers its translations under plugin-ecommerce, so editors saw raw keys like ecommerce:variantOptionsAlreadyExists instead of the message.

How?

Switched the four keys in validateOptions to plugin-ecommerce:… and added a unit spec that checks each one resolves to its English message.

3.x backport: #19028

Fixes #19021

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between e442a3f and fc7d8e6.

📒 Files selected for processing: 2
  • packages/plugin-ecommerce/src/collections/variants/createVariantsCollection/hooks/validateOptions.spec.ts
  • packages/plugin-ecommerce/src/collections/variants/createVariantsCollection/hooks/validateOptions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

The four variant-options validation errors now use the plugin-ecommerce translation namespace. Tests cover the translated messages for empty selections, a missing product, incomplete selections, and duplicate option combinations.

Changes: Variant option validation

Layer / File(s) Summary
Validation messages and tests
packages/plugin-ecommerce/src/collections/variants/createVariantsCollection/hooks/validateOptions.ts, packages/plugin-ecommerce/src/collections/variants/createVariantsCollection/hooks/validateOptions.spec.ts
The four validation errors now use plugin-ecommerce translation keys. Tests check the translated messages for each error case.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: jarrodmflesch

Merge Risk: ⚪ Minimal · up to fc7d8

The translation-key correction and its four validation cases are covered; no actionable merge risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: using the plugin-ecommerce namespace for variant options validation messages.
Description check Passed The description directly explains the namespace mismatch, the four-key change, the user-visible issue, and the added unit test.
Linked Issues check Passed Issue #19021 requires translated variant-options validation messages for four keys. validateOptions.ts now uses plugin-ecommerce: for variantOptionsRequired, productRequired, `variantOptionsRe…
Out of Scope Changes check Passed The changes are limited to the namespace fix in validateOptions.ts and supporting unit tests in validateOptions.spec.ts. Both changes directly support issue #19021. No unrelated changes are shown.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Linked Issues check

Explanation

Issue #19021 requires translated variant-options validation messages for four keys. validateOptions.ts now uses plugin-ecommerce: for variantOptionsRequired, productRequired, variantOptionsRequiredAll, and variantOptionsAlreadyExists. The new validateOptions.spec.ts checks all four messages against the English plugin-ecommerce translations.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@lazerg

lazerg commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Hey @jacobsfletch, please take a look when you have time~

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(plugin-ecommerce): variant options validation shows raw translation keys

1 participant