Skip to content

TRAC-362: add optional requestOptions to itemAdd and handleItemAdd for locale-aware cart requests#240

Merged
bc-yevhenii-buliuk merged 1 commit intomasterfrom
TRAC-362
Apr 7, 2026
Merged

TRAC-362: add optional requestOptions to itemAdd and handleItemAdd for locale-aware cart requests#240
bc-yevhenii-buliuk merged 1 commit intomasterfrom
TRAC-362

Conversation

@bc-yevhenii-buliuk
Copy link
Copy Markdown
Contributor

@bc-yevhenii-buliuk bc-yevhenii-buliuk commented Apr 2, 2026

Jira: TRAC-362

What/Why?

This PR adds optional requestOptions param to itemAdd() and handleItemAdd() for multi-lang support

BigCommerce supports multi-language via URL subfolder locales (e.g. /es, /fr). When a shopper is on site.com/es, AJAX requests must include the /es prefix so the server returns translated content.

itemAdd() and handleItemAdd() previously ignored the third argument, making it impossible to pass baseUrl from the theme. As a result, the add-to-cart request was sent to /remote/v1/cart/add instead of /es/remote/v1/cart/add, and the cart modal displayed untranslated content.

Rollout/Rollback

revert the PR

Testing

TRAC_362_fix_testing_on_Integration.mov
add-es-product-to-cart.mov

Note

Low Risk
Low risk: small, backward-compatible signature change that only threads an optional baseUrl through the existing request options for add-to-cart; main risk is inadvertent behavior change if callers relied on the ignored third argument.

Overview
Enables locale-aware add-to-cart requests by adding an optional requestOptions parameter to cart.itemAdd() and cart.handleItemAdd() and forwarding requestOptions.baseUrl into the underlying /cart/add remote request.

Updates unit tests to assert baseUrl is passed through when provided and that calls without requestOptions remain backward compatible.

Reviewed by Cursor Bugbot for commit 52b6ef6. Bugbot is set up for automated code reviews on this repo. 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.

could you check all calls related to remoteRequest. Thanks.

@bc-yevhenii-buliuk bc-yevhenii-buliuk merged commit a3ea075 into master Apr 7, 2026
4 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🎉 This PR is included in version 6.22.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.

4 participants