fix(sales): admin reorder drops OOS items when backorders disabled (#39958)#40833
Open
lbajsarowicz wants to merge 2 commits into
Open
fix(sales): admin reorder drops OOS items when backorders disabled (#39958)#40833lbajsarowicz wants to merge 2 commits into
lbajsarowicz wants to merge 2 commits into
Conversation
On non-MSI stores with backorders disabled, Admin "Reorder" produced an empty quote and the message "This product is out of stock" with all order details missing. Create::initFromOrderItem calls Quote::addProduct, which invokes Product::isSalable; StockRegistry then reports is_in_stock=false for any product whose live stock has depleted since the original order, and the item is silently skipped. IsSuperMode does not help here: it only short-circuits QuantityValidatorObserver, which fires later in the pipeline. Enable Catalog\Helper\Product::skipSaleableCheck for the duration of initFromOrder so the admin can rebuild the original order regardless of current stock state. The flag is restored in a finally block so the helper's state does not leak to other code paths in the same request. Fixes magento#39958
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
…jectManager Replaces the inline $this->_objectManager->get(\Magento\Catalog\Helper\Product::class) call inside initFromOrder() with a properly constructor-injected dependency. The parameter is nullable with a null default to preserve BC for subclasses, with an ObjectManager fallback in the constructor body following the existing pattern used by other late-added dependencies in this class. Updates the unit test to supply a mock of the helper directly via the ObjectManagerHelper argument array, removing the objectManager->get stub.
Contributor
Author
|
@magento run all tests |
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.
Description
On non-MSI stores with backorders disabled, Admin "Reorder" produced an
empty quote and the message
This product is out of stockwith allorder details missing.
Create::initFromOrderItemcallsQuote::addProduct, which invokesProduct::isSalable;StockRegistrythen reports
is_in_stock=falsefor any product whose live stock hasdepleted since the original order, and the item is silently skipped.
IsSuperModedoes not help here: it only short-circuitsQuantityValidatorObserver, which fires later in the pipeline.Enable
Catalog\Helper\Product::skipSaleableCheckfor the duration ofinitFromOrderso the admin can rebuild the original order regardlessof current stock state. The flag is restored in a
finallyblock so thehelper's state does not leak to other code paths in the same request.
Fixes #39958
Fixed Issues
Manual testing scenarios
Contribution checklist