fix(backorders): BACK-637 respect unlimited_backorder on PDP for simple and complex products#2671
Merged
Conversation
…le and complex products When `unlimited_backorder = true`, the PDP backorder calculations now skip the `available_for_backorder` and `available_to_sell` caps so that: - the "N will be backordered" quantity message renders for any qty above on-hand stock; - the backorder availability prompt renders; - the Add to Cart button is no longer disabled with a "max purchasable" error when quantity exceeds available_to_sell. Mirrors the existing picklist (complex product) backorder logic in picklist-backorder.js. The `unlimited_backorder` flag is injected from the Stencil product context on initial render and refreshed from the variant-attributes endpoint response on variant change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
alex-gaiduchok
approved these changes
Jun 3, 2026
agchan12
approved these changes
Jun 3, 2026
Meztimuro
approved these changes
Jun 3, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 a09a906. Configure here.
Merged
5 tasks
bc-maksym-konohorov
approved these changes
Jun 3, 2026
animesh1987
approved these changes
Jun 3, 2026
# Conflicts: # CHANGELOG.md # assets/js/theme/common/product-details-base.js
rtalvarez
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What?
Screen.Recording.2026-06-03.at.13.04.43.mov
Fixes PDP backorder rendering when a product is configured with unlimited backorder. Previously, both simple and complex products on the storefront PDP ignored
unlimited_backorder = trueand clamped calculations byavailable_for_backorder/available_to_sell, which caused:This change mirrors the picklist (complex product) logic in
picklist-backorder.js: whenunlimited_backorder === true, theavailable_for_backorderandavailable_to_sellcaps are treated asInfinity, so the backorder UI renders correctly and the Add to Cart cap is lifted.Files changed:
templates/components/products/product-view.html— injectunlimitedBackorderfromproduct.unlimited_backorderinto the JS context.assets/js/theme/common/product-details-base.js:updateBackorderContext— pick updata.unlimited_backorderfrom the/remote/v1/product-attributes/{id}variant-change response so the flag updates when the shopper switches variants.updateQtyBackorderedMessage— when unlimited, drop theavailable_for_backorderclamp on the backordered quantity and treatwithinSellLimitas always true so the "N will be backordered" message renders.updateAddToCartForQty— when unlimited, treatavailableToSellasInfinityso the qty cap and "max purchasable" message are not applied.updateBackorderPrompt— when unlimited, treatavailableForBackorder/availableToSellasInfinityso the backorder availability prompt is shown.CHANGELOG.md— Draft entry added.Requirements
Tickets / Documentation
Screenshots (if appropriate)
N/A — UI behavior change verified by selecting a qty above on-hand on a product configured with unlimited backorder.
Test plan
unlimited_backorder = true: select a qty above on-hand stock on the PDP. Expect the backorder availability prompt, the "N will be backordered" message, and the backorder message to render. Add to Cart stays enabled and no "max purchasable" error is shown.unlimited_backorder = true: select a variant, set qty above on-hand. Expect the same backorder UI to render. Switch to a variant without unlimited backorder and confirm the normal caps reapply.available_for_backorderandavailable_to_sellstill renders the existing capped backorder message and disables Add to Cart when qty exceeds ATS.🤖 Generated with Claude Code
Note
Medium Risk
Changes PDP purchase and backorder messaging logic; mis-handling could allow over-ordering or hide limits for finite backorder products, but scope is limited to the new flag and mirrors existing picklist behavior.
Overview
Respects
unlimited_backorderon the PDP so storefront behavior matches cart/checkout when a product allows unlimited backorder.product-view.htmlnow injectsunlimitedBackorderinto the JS context. Inproduct-details-base.js, when that flag is true,available_for_backorderandavailable_to_sellare treated as unbounded (Infinity) for backorder qty messaging, the availability prompt, and Add to Cart quantity limits.updateBackorderContextalso readsunlimited_backorderfrom variant/product-attribute API responses so the flag stays correct after option changes.Draft CHANGELOG entry documents the fix.
Reviewed by Cursor Bugbot for commit 874349b. Bugbot is set up for automated code reviews on this repo. Configure here.