Skip to content

feat(pdp): polish PDP backorder availability display (BACK-636)#2670

Closed
bc-apostoliuk wants to merge 2 commits into
masterfrom
BACK-636
Closed

feat(pdp): polish PDP backorder availability display (BACK-636)#2670
bc-apostoliuk wants to merge 2 commits into
masterfrom
BACK-636

Conversation

@bc-apostoliuk

@bc-apostoliuk bc-apostoliuk commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What?

Polishes the Stencil PDP backorder/on-hand stock display so it matches the intended design (and Catalyst implementation).
Screenshot 2026-06-02 at 20 19 31

Changes:

  • On-hand stock labeltemplates/components/products/product-view.html now renders the stock count as <strong>{stock_level}</strong> in stock instead of Current Stock: {stock_level}. The <span data-product-stock> was replaced with <strong data-product-stock> so the quantity is bold; the surrounding label still picks up font-weight: bold from new scoped SCSS for the rest of the row text.
  • New lang key — Added products.in_stock ("in stock") in lang/en.json. The old products.current_stock key is retained for any other consumers.
  • Backorder availability prompt — Dropped the hardcoded (...) wrapper in both the Handlebars template and assets/js/theme/common/product-details-base.js (updateBackorderAvailabilityPrompt). The prompt text is now rendered raw.
  • Bolded backordered quantityupdateQtyBackorderedMessage in product-details-base.js now wraps the quantity in <strong> and writes via .html(). The __QTY__ token substitution in the merchant-provided message keeps working (the bold markup is injected before substitution).
  • Vertical divider + typographyassets/scss/components/stencil/productView/_productView.scss:
    • .productView-backorder-availability-prompt and [data-backorder-message] now share a border-left divider with matching margin-left/padding-left, replacing the previous plain margin-left-only rule. Both elements also explicitly use font-weight: normal so the divider/message text doesn't inherit the bold weight from the parent label.
    • Added .form-field--stock .form-label--alternate { font-weight: bold; } so the X in stock / X will be backordered rows render bold, while the prompt/message after the divider stays at normal weight.

The divider naturally hides when there is no prompt/message because those spans are emptied or set to display: none by the existing logic.

Requirements

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

Tickets / Documentation

Screenshots (if appropriate)

Before:

Current Stock: 0 / (More available for backorder) — regular weight, no divider, parentheses around the prompt.

After:

0 in stock │ More available for backorder
1 will be backordered │ test test

🤖 Generated with Claude Code


Note

Low Risk
Presentation-only changes to PDP stock/backorder copy and styles; backordered quantity HTML is built from a numeric value only.

Overview
Polishes the PDP backorder / on-hand stock row so it matches the intended design: bold quantity, "in stock" copy, and a divider before the prompt or backorder message.

The stock label in product-view.html switches from Current Stock: {level} to {level} in stock (new products.in_stock in lang/en.json; current_stock is unchanged for other callers). The on-hand count uses <strong data-product-stock>. The backorder availability prompt is shown without hardcoded parentheses in both the template and updateBackorderPrompt in product-details-base.js.

When quantity triggers a backorder line, updateQtyBackorderedMessage wraps the count in <strong> and uses .html() so __QTY__ in the merchant message can stay bold. SCSS bolds .form-field--stock labels, sets normal weight on the prompt and [data-backorder-message], and adds a left border divider between the main stock text and those segments.

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

- Render on-hand stock as "X in stock" (was "Current Stock: X")
- Bold the on-hand and backordered quantities for emphasis
- Drop the hardcoded "()" wrapping the backorder availability prompt
- Add a vertical divider between the quantity and the backorder
  prompt/message rows; the divider hides when no prompt/message is shown

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@bc-apostoliuk bc-apostoliuk requested a review from a team as a code owner June 2, 2026 17:15
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@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 2 potential issues.

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 fc5fb79. Configure here.

border-left: 1px solid stencilColor("color-textSecondary");
font-weight: fontWeight("normal");
margin-left: spacing("half");
padding-left: spacing("half");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty backorder message span shows stray border divider

Medium Severity

The new border-left on [data-backorder-message] renders a stray vertical divider when the element is empty. Unlike $backorderPrompt which uses .hide() to set display: none, $backorderMessage is only cleared with .text('') — the element remains in the layout. An empty inline <span> with border-left and padding-left still renders a visible border line at the line height of its parent, producing an unwanted visual artifact next to the backordered quantity message whenever no backorder message is configured.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc5fb79. Configure here.

Comment thread lang/en.json
},
"products": {
"current_stock": "Current Stock:",
"in_stock": "in stock",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

New lang key missing from all non-English locale files

Medium Severity

The template now uses {{lang 'products.in_stock'}} instead of {{lang 'products.current_stock'}}, but the new products.in_stock key was only added to lang/en.json. The replaced products.current_stock key has translations in da.json, de.json, es-419.json, es-AR.json, and likely others. Non-English storefronts will now display the English fallback "in stock" instead of a localized label, which is a regression from the previously translated stock text.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc5fb79. Configure here.

@bc-apostoliuk

Copy link
Copy Markdown
Contributor Author

Closing as redundant — BACK-636 polish was already implemented on master via #2662 (BACK-655) with a cleaner CSS-only approach.

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.

1 participant