Skip to content

fix(storefront): TRAC-1466 Show option-set rule message on rule-blocked options - #2735

Merged
bc-yevhenii-buliuk merged 1 commit into
bigcommerce:masterfrom
bc-yevhenii-buliuk:TRAC-1466
Sep 3, 2026
Merged

fix(storefront): TRAC-1466 Show option-set rule message on rule-blocked options#2735
bc-yevhenii-buliuk merged 1 commit into
bigcommerce:masterfrom
bc-yevhenii-buliuk:TRAC-1466

Conversation

@bc-yevhenii-buliuk

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

Copy link
Copy Markdown
Contributor

What?

Cornerstone versions after 6.19.0 stopped showing an option-set rule's custom "unavailable" message (e.g. "This Size Temporarily Sold Out"), even though Add to Cart and the quantity input still correctly
disabled. This affects legacy-catalog (v2) products with no SKUs, an option-set rule set to "unavailable for purchase" with a custom message, and product-level inventory tracking off.

Root cause: in product-details-base.js, updateView() called showMessageBox() (which renders the rule's message) before updateDefaultAttributesForOOS(). The latter calls toggleSoldOutAlert(), which
unconditionally hides that same message box whenever the product itself is sellable (instock: true) - regardless of whether the specific option combination is blocked by a rule (purchasable: false). The backend
sends exactly this combination (instock: true + purchasable: false) when inventory isn't tracked at the product level, so the rule's message was shown and then immediately hidden on every option change.

Fixes:

  1. Moved the showMessageBox() call to run after updateDefaultAttributesForOOS(), so the rule message is set last and isn't overwritten by the stock check.
  2. showMessageBox() now clears a stale data-qty-limit flag when it sets its own message, so a later quantity-limit check (updateAddToCartForQty) doesn't mistake this message for its own and delete it.
  3. updateAddToCartForQty() now skips overwriting the box with a "maximum purchasable quantity" message when Add to Cart/quantity are already disabled for a more fundamental reason (a rule or true out-of-stock) - a customer who can't buy an item at all shouldn't see a quantity-limit message instead of the actual reason. This check is based on the button's disabled state (set earlier by the OOS/rule check), so it stays correct for backorderable items that can still show a stale stock_message while remaining purchasable (see BACK-633 / commit 083e45f).

Testing:
Verified both with unit tests and manually on two live stores, since option-set rules (no-SKU products) and backorder limits (SKU-level) can't coexist on the same product:

  • Legacy v2 catalog store, rule-blocked option: the custom rule message now shows and stays visible (fix 1).
  • Backorder-enabled store, switching between a qty-limited variant and an out-of-stock/unavailable variant with a leftover quantity in the field: the correct message (rule/unavailable/OOS) is preserved instead of being wiped by a stale data-qty-limit flag (fix 2), and instead of being overwritten by a "maximum purchasable quantity" message when the variant is separately marked unpurchasable (fix 3).
  • Confirmed no regression for normal backorder quantity limits (over-limit quantity on a purchasable backorderable variant still shows the correct "maximum purchasable quantity" message and disables Add to Cart).

Requirements

  • CHANGELOG.md entry added (required for code changes only)

Tickets / Documentation

Screenshots (if appropriate)

FIX 1
Tested using bundle with the fixes in staff sandbox that has legacy product catalogue (v2)

Screenshot 2026-09-02 at 14 35 12

before:

Screen.Recording.2026-09-02.at.14.31.54.mov

after:

Screen.Recording.2026-09-02.at.14.31.06.mov

FIX 2

Screenshot 2026-09-02 at 20 49 14 Screenshot 2026-09-02 at 20 49 41

before:

Screen.Recording.2026-09-02.at.20.19.04.mov

after:

Screen.Recording.2026-09-02.at.20.19.38.mov

FIX 3

Screenshot 2026-09-02 at 20 47 34 Screenshot 2026-09-02 at 20 47 13

before:

Screen.Recording.2026-09-02.at.20.46.07.mov

after:

Screen.Recording.2026-09-02.at.20.39.30.mov

Note

Medium Risk
Touches PDP option-change messaging and add-to-cart/qty-limit ordering; regression risk for backorder quantity limits and OOS flows, though changes are narrowly scoped to message box timing and flags.

Overview
Restores custom option-set rule messages on the PDP when a combination is unpurchasable but the product still looks sellable (e.g. legacy v2, no SKUs, inventory not tracked at product level). Add to Cart and quantity were already disabled; the alert text was missing or wrong.

In product-details-base.js, showMessageBox now runs after updateDefaultAttributesForOOS, so toggleSoldOutAlert no longer hides the variant alert whenever instock / ATS says the product can sell while the selected options are rule-blocked.

showMessageBox clears data-qty-limit when it sets a rule/stock message so updateAddToCartForQty does not treat that box as its own and clear or replace it.

updateAddToCartForQty skips the “maximum purchasable quantity” message when quantity controls are already disabled (rule or true OOS); it only keeps Add to Cart disabled instead of swapping the shopper’s real reason for a qty-cap message.

CHANGELOG Draft entry added for [#2735].

Reviewed by Cursor Bugbot for commit 781a014. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread assets/js/theme/common/product-details-base.js Outdated
Comment thread assets/js/theme/common/product-details-base.js
@bc-yevhenii-buliuk
bc-yevhenii-buliuk force-pushed the TRAC-1466 branch 2 times, most recently from 56861b3 to bed3267 Compare September 2, 2026 14:33
@bc-yevhenii-buliuk bc-yevhenii-buliuk changed the title fix(storefront): TRAC-1466 Show option-set rule message on rule-blocked options [DRAFT] fix(storefront): TRAC-1466 Show option-set rule message on rule-blocked options Sep 2, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

Reviewed by Cursor Bugbot for commit bed3267. Configure here.

Comment thread assets/js/theme/common/product-details-base.js
@bc-yevhenii-buliuk bc-yevhenii-buliuk changed the title [DRAFT] fix(storefront): TRAC-1466 Show option-set rule message on rule-blocked options fix(storefront): TRAC-1466 Show option-set rule message on rule-blocked options Sep 2, 2026
@bc-yevhenii-buliuk
bc-yevhenii-buliuk merged commit 897d9af into bigcommerce:master Sep 3, 2026
2 checks passed
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.

2 participants