Skip to content

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

Open
lazerg wants to merge 1 commit into
payloadcms:3.xfrom
lazerg:fix/issue-19021-variant-options-translation-keys-3x
Open

lazerg wants to merge 1 commit into
payloadcms:3.xfrom
lazerg:fix/issue-19021-variant-options-translation-keys-3x

Conversation

@lazerg

@lazerg lazerg commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Backport of #19027 to 3.x.

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.

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 8b31ddf and d1c694a.

📒 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; 7 remain after this review.

📝 Walkthrough

validateOptions now uses the plugin-ecommerce translation namespace for its four error messages. New tests check the translated messages for missing options, a missing product, incomplete options, and duplicate option combinations.

Changes: Variant option translations

Layer / File(s) Summary
Update 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 use the plugin-ecommerce namespace. Tests check the translated messages for all four validation cases.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Suggested labels: v3

Suggested reviewers: paulpopus

Merge Risk: ⚪ Minimal · up to d1c69

The validation messages use the plugin’s registered translations, and the added tests protect against the reported regression. No actionable merge risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title names the actual change: variant options validation messages in plugin-ecommerce switch to the plugin-ecommerce translation namespace. It matches the raw summary, the PR objectives, and the …
Description check Passed The description states the change, the reason for it, and the approach. It says validateOptions used the ecommerce namespace while the plugin registers under plugin-ecommerce, so editors saw raw keys.…
Linked Issues check Passed The PR addresses the coding requirement in #19021. validateOptions now uses plugin-ecommerce for all four affected keys: variantOptionsRequired, productRequired, variantOptionsRequiredAll, a…
Out of Scope Changes check Passed The changed files are limited to the validateOptions namespace fix and its focused unit tests. Both changes directly support #19021. No unrelated behavior or files 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: Title check

Explanation

The title names the actual change: variant options validation messages in plugin-ecommerce switch to the plugin-ecommerce translation namespace. It matches the raw summary, the PR objectives, and the description. It is specific and uses a conventional fix() prefix. It is slightly long at 93 characters, but it stays readable.

Full details: Description check

Explanation

The description states the change, the reason for it, and the approach. It says validateOptions used the ecommerce namespace while the plugin registers under plugin-ecommerce, so editors saw raw keys. It names the four keys, notes the added unit spec, and links the issue #19021. This matches the changed files and the linked issue objectives.

Full details: Linked Issues check

Explanation

The PR addresses the coding requirement in #19021. validateOptions now uses plugin-ecommerce for all four affected keys: variantOptionsRequired, productRequired, variantOptionsRequiredAll, and variantOptionsAlreadyExists. The new validateOptions.spec.ts covers all four validation paths and checks the translated English messages.

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: 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/plugin-ecommerce/src/collections/variants/createVariantsCollection/hooks/validateOptions.spec.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

packages/plugin-ecommerce/src/collections/variants/createVariantsCollection/hooks/validateOptions.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

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

@lazerg

lazerg commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

The int (3/3) failures come from the email-nodemailer suite timing out on Ethereal. #19022 fixed that on 3.x after I cut this branch, so this change doesn't cause them.

@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant