Skip to content

TRAC-366: audit and fix Stencil theme remote API calls for multi-language subfolder support#241

Merged
bc-yevhenii-buliuk merged 1 commit intomasterfrom
TRAC-366
Apr 8, 2026
Merged

TRAC-366: audit and fix Stencil theme remote API calls for multi-language subfolder support#241
bc-yevhenii-buliuk merged 1 commit intomasterfrom
TRAC-366

Conversation

@bc-yevhenii-buliuk
Copy link
Copy Markdown
Contributor

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

Jira: TRAC-366

What/Why?

This PR adds optional requestOptions param to optionChange(), configureInCart(), and getShippingQuotes() for multi-lang subfolder 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 (option names, availability messages, shipping quotes HTML, etc.).

Previously these methods ignored any requestOptions passed from the theme, making it impossible to forward baseUrl from the theme context. As a result, requests were sent to the non-prefixed remote endpoints and the server returned untranslated content.

Affected methods and endpoints

Method API class Endpoint HTTP
optionChange() productAttributes /remote/v1/product-attributes/{productId} POST
configureInCart() productAttributes /remote/v1/configure-options/{itemId} GET
getShippingQuotes() cart /remote/v1/shipping-quote GET

getItemGiftWrappingOptions() required no changes — it already forwards the entire options object to the request layer, so { template, baseUrl } from the theme works without modification.

Rollout/Rollback

revert the PR

Testing

testing bundle on employee store

before:
PDP -> productOptionsChanged
trac_366_bug_PDP

cart -> configureInCart
trac_366_bug_configure_options

cart -> optionChange
trac_366_bug_cart_options_change

cart -> getItemGiftWrappingOptions
trac_366_bug_cart_gift_wrapping

after:
PDP -> productOptionsChanged
trac_366_fix_PDP

cart -> configureInCart
trac_366_fix_configure_options

cart -> optionChange
trac_366_fix_cart_options_change

cart -> getItemGiftWrappingOptions
trac_366_fix_cart_gift_wrapping


Note

Medium Risk
Updates public API method signatures and argument-shifting behavior for remote requests; risk is mainly backward-compatibility/edge cases in optional-argument parsing affecting shipping quotes and product option updates.

Overview
Fixes remote API helpers to preserve and forward requestOptions (notably baseUrl for multi-language subfolder URLs) when calling CartApi.getShippingQuotes and ProductAttributes.optionChange/configureInCart.

Adds/updates Jest coverage to validate the new optional-argument shifting and that template, params, and baseUrl are merged correctly without being dropped or overwritten.

Reviewed by Cursor Bugbot for commit d3eaf6b. 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.

Reviewed by Cursor Bugbot for commit a954e56. Configure here.

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

github-actions bot commented Apr 8, 2026

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