Skip to content

feat(backorders): BACK-472 Add backorder availability prompt for complex products#2619

Merged
bc-apostoliuk merged 1 commit intomasterfrom
BACK-470-complex
Mar 3, 2026
Merged

feat(backorders): BACK-472 Add backorder availability prompt for complex products#2619
bc-apostoliuk merged 1 commit intomasterfrom
BACK-470-complex

Conversation

@bc-apostoliuk
Copy link
Contributor

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

Jira: BACK-472

What/Why?

Screenshot 2026-03-02 at 17 12 01

The backorder availability prompt ("More available for backorder") and the dynamic backordered quantity message were only working for simple products. For complex products (products with variants), the prompt element was not rendered in the DOM, and the JS had no way to update backorder context when a variant was selected.

This PR:

  • Inlines the backorder prompt into product-view.html (removing the separate backorder-availability-prompt.html partial) and always renders the data-backorder-prompt span so JS can target it
  • Injects missing context values (availableToSell, showBackorderAvailabilityPrompt, backorderAvailabilityPrompt, quantityBackorderedMessage) into the JS context
  • Adds updateBackorderContext() to sync variant-level backorder data from the option-change API response into the context
  • Adds updateBackorderPrompt() to dynamically show/hide the "(More available for backorder)" prompt based on the selected variant's inventory
  • Enhances updateQtyBackorderedMessage() with sell-limit checks, DOM stock fallback, localized messages, and showBackorderAvailabilityPrompt guard
  • Wires both methods into updateView() so they fire on every option change

Rollout/Rollback

Standard deployment. Rollback by reverting the PR if needed.

Testing

  1. Navigate to a simple product with backorder enabled — verify the prompt and quantity message still work as before
  2. Navigate to a complex product (with variants) that has backorder enabled
    • Select a variant with backorder available — verify "(More available for backorder)" prompt appears next to the stock level
    • Increase quantity beyond on-hand stock — verify the "X will be backordered" message appears
    • Switch to a variant without backorder — verify the prompt and message hide
  3. Verify no regressions on products without backorder settings enabled

Made with Cursor

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds variant-aware backorder UI support so the “More available for backorder” prompt and backordered-quantity message can be updated for complex (variant) products via option-change responses.

Changes:

  • Inline-renders a data-backorder-prompt span in product-view.html (and removes the separate partial) so the prompt element always exists in the DOM.
  • Injects backorderAvailabilityPrompt into the page JS context.
  • Extends ProductDetailsBase to sync prompt text from option-change data and dynamically show/hide the backorder prompt on variant selection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
templates/components/products/product-view.html Always renders the backorder prompt span and injects backorderAvailabilityPrompt for JS use.
templates/components/products/backorder-availability-prompt.html Removes the now-unneeded partial template.
assets/js/theme/common/product-details-base.js Adds a viewModel reference to the prompt element, updates backorder context, and toggles prompt visibility during updateView().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…lex products

Enable the backorder availability prompt and quantity message for
products with variants by dynamically updating backorder context
from the option-change API response.

Made-with: Cursor
Copy link

@BC-RSikora BC-RSikora left a comment

Choose a reason for hiding this comment

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

LGTM

@bc-apostoliuk bc-apostoliuk merged commit fc4257d into master Mar 3, 2026
1 check passed
@bc-apostoliuk bc-apostoliuk deleted the BACK-470-complex branch March 3, 2026 07:37
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.

4 participants