feat(backorders): BACK-472 render backorder quantity prompt for complex products on PDP#2618
Merged
bc-apostoliuk merged 1 commit intomasterfrom Mar 2, 2026
Conversation
EgorAleshin
approved these changes
Mar 2, 2026
…ex products on PDP Update the backorder quantity message to work for complex products (with variants) in addition to simple products. When a variant is selected, inventory context (availableOnHand, availableForBackorder, availableToSell) is refreshed from the optionChange API response so the backorder calculation uses the correct variant-level values. Changes: - Inject availableToSell, showBackorderAvailabilityPrompt, and the i18n backorder message into the JS context - Add updateBackorderContext() to refresh inventory values on variant change, with fallback to data.stock when available_on_hand is absent - Recalculate the backorder message inside updateView() after every variant selection - Use the i18n string (products.quantity_backordered) instead of hardcoded text - Read displayed stock from the DOM as fallback for onHand to handle products where available_on_hand is not populated - Respect showBackorderAvailabilityPrompt merchant setting - Preserve backward compatibility for simple products Made-with: Cursor
08c8e6a to
fee238f
Compare
bc-maksym-konohorov
approved these changes
Mar 2, 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.
Jira: BACK-472
What/Why?
Screen.Recording.2026-03-02.at.14.05.42.mov
The "quantity on backorder" prompt on the PDP only worked for simple products. For complex products (with variants),
availableOnHandandavailableForBackorderwere injected once at page load and never updated when a different variant was selected, causing incorrect backorder calculations.This PR:
availableToSell,showBackorderAvailabilityPrompt, and the i18n backorder message (products.quantity_backordered) into the JS contextupdateBackorderContext()to refresh variant-level inventory values (availableOnHand,availableForBackorder,availableToSell) from theoptionChangeAPI response on every variant selectiondata.stock(and the displayed stock DOM value) whenavailable_on_handis not present in the API responseupdateView()after every variant changeshowBackorderAvailabilityPromptsettingRollout/Rollback
Standard deployment. Rollback by reverting the PR if needed.
Testing
Simple product with backorder enabled:
Complex product (with variants) with backorder enabled:
Merchant settings:
Edge cases:
availableToSell→ no backorder message (OOS)Made with Cursor