Skip to content

fix(backorders): BACK-674 keep PDP backorder row visible when qty exceeds available_to_sell#2672

Merged
bc-apostoliuk merged 1 commit into
masterfrom
BACK-674
Jun 8, 2026
Merged

fix(backorders): BACK-674 keep PDP backorder row visible when qty exceeds available_to_sell#2672
bc-apostoliuk merged 1 commit into
masterfrom
BACK-674

Conversation

@bc-apostoliuk

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

Copy link
Copy Markdown
Contributor

What?

Screen.Recording.2026-06-03.at.13.23.13.mov

When a shopper on the storefront PDP enters a quantity that exceeds available_to_sell, the PDP already surfaces the existing "The maximum purchasable quantity is N" error on the Add to Cart button. Previously, the "N will be backordered" row was also hidden in this state — leaving the shopper without any explanation of how many of the requested qty would be backordered or why the qty was clamped.

This change drops the within-sell-limit gate in both the main-product and picklist backorder quantity calculations. The backordered line now renders whenever backordered > 0, still clamped by available_for_backorder for non-unlimited products, independent of whether the requested qty is within the sell limit.

Files changed:

  • assets/js/theme/common/product-details-base.jsupdateQtyBackorderedMessage: removed the withinSellLimit gate. The row now renders whenever backordered > 0.
  • assets/js/theme/common/picklist-backorder.jsbuildLines: removed the withinSellLimit early-return so each picklist line continues to render when the main qty exceeds that sub-product's ATS (still clamped by its available_for_backorder).
  • assets/js/test-unit/theme/common/picklist-backorder.spec.js — updated the "skip when qty exceeds ATS" test to assert the line now renders with the clamped backorder count instead. All 27 tests pass.
  • CHANGELOG.md — Draft entry added.

Requirements

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

Tickets / Documentation

Note: independent of BACK-637 / PR #2671 (unlimited_backorder support). Both target the same gate and may produce a small merge conflict depending on merge order; either can merge first.

Screenshots (if appropriate)

N/A — UI behavior change verified by setting qty above ATS on a backorderable product and confirming both the "maximum purchasable quantity" error and the "N will be backordered" row are visible together.

Test plan

  • On a storefront with a product that has a numeric backorder limit (e.g. on-hand = 2, available_for_backorder = 5, available_to_sell = 7): enter qty = 10 on the PDP. Expect both "The maximum purchasable quantity is 7" on the Add to Cart button and "5 will be backordered" in the backorder row to be visible at the same time.
  • Same scenario for a complex product with picklist options: enter qty above a sub-product's ATS. Expect the picklist line "Option Name: N will be backordered" to remain visible alongside the cart-level error.
  • Regression check: when qty is within ATS, the backorder row continues to render correctly (still clamped by available_for_backorder).
  • Regression check: when on-hand covers requested qty (no backorder needed), the backorder row is hidden as before.

🤖 Generated with Claude Code


Note

Low Risk
Storefront-only display logic for backorder messaging; add-to-cart limits for available_to_sell are unchanged.

Overview
When shoppers enter a quantity above available_to_sell on the PDP, the theme still shows the maximum purchasable quantity error on Add to Cart (unchanged). This PR stops hiding the "N will be backordered" row in that situation.

Main product: updateQtyBackorderedMessage no longer requires qty to be within the sell limit; the backorder message appears whenever the computed backorder count is > 0, still capped by available_for_backorder.

Picklist options: PicklistBackorder.buildLines drops the same sell-limit early return so bundled picklist lines stay visible when main qty exceeds a sub-product's ATS, with the same backorder clamping.

Unit test and CHANGELOG draft updated accordingly.

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

…eeds available_to_sell

When a shopper enters a quantity above available_to_sell, the PDP
already surfaces "The maximum purchasable quantity is N" on the Add to
Cart button. The "N will be backordered" row was additionally being
hidden in that state, which left the shopper without an explanation of
why the qty was clamped.

Drops the within-sell-limit gate in both the main-product
(product-details-base.js) and picklist (picklist-backorder.js) backorder
quantity calculations. The backordered line now renders whenever
backordered > 0 (still clamped by available_for_backorder), independent
of whether the requested qty is within the sell limit.

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 3, 2026 10:20
@bc-apostoliuk bc-apostoliuk merged commit 1dde38b into master Jun 8, 2026
9 checks passed
@bc-apostoliuk bc-apostoliuk deleted the BACK-674 branch June 8, 2026 07:27
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.

6 participants