Skip to content

TRAC-303: add optional options param to getByName for multi-lang support#227

Merged
bc-yevhenii-buliuk merged 1 commit intomasterfrom
TRAC-303
Mar 31, 2026
Merged

TRAC-303: add optional options param to getByName for multi-lang support#227
bc-yevhenii-buliuk merged 1 commit intomasterfrom
TRAC-303

Conversation

@bc-yevhenii-buliuk
Copy link
Copy Markdown
Contributor

@bc-yevhenii-buliuk bc-yevhenii-buliuk commented Mar 31, 2026

Jira: TRAC-303

What/Why?

This PR adds optional options param to getByName() for multi-lang support

BigCommerce supports multi-language via URL subfolder locales (e.g. /fr, /de).
When a shopper is on site.com/fr, AJAX requests must include the /fr prefix so the server returns translated content.
getByName() previously hardcoded {} as options, making it impossible to pass baseUrl
from the theme. As a result, the country-states request was sent to /remote/v1/country-states/{name}
instead of /fr/remote/v1/country-states/{name}, and state names were returned untranslated.

Rollout/Rollback

revert the PR

Testing

trac_303_testing_on_Integration.mov

Note

Low Risk
Small, backwards-compatible change limited to request option passing plus unit tests; low risk aside from potential edge cases in argument detection.

Overview
Updates Country.getByName to accept an optional options argument and forward it to remoteRequest, while remaining backwards-compatible with the legacy (name, callback) signature.

Adds Jest coverage to ensure the correct URL is used, options (including baseUrl for multi-language subfolder locales) are passed through, and undefined options are handled safely.

Written by Cursor Bugbot for commit c946c9f. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Copy link
Copy Markdown

@funivan funivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@bc-yevhenii-buliuk bc-yevhenii-buliuk merged commit 31856da into master Mar 31, 2026
4 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🎉 This PR is included in version 6.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

3 participants