-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimum Qty Allowed in Shopping Cart not working on related product #19566
Minimum Qty Allowed in Shopping Cart not working on related product #19566
Conversation
Hi @mageprince. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@magento-engcom-team give me 2.3-develop instance |
Hi @mageprince. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @mageprince, here is your Magento instance. |
@magento-engcom-team Issue reproduced in the test instance |
$stockItem = $this->stockRegistry->getStockItem($productId, $product->getStore()->getWebsiteId()); | ||
$minimumQty = $stockItem->getMinSaleQty(); | ||
if ($minimumQty && $minimumQty > 0) { | ||
$request = $minimumQty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Complex logic related to inventory must not be added in Checkout
module. We can have much more checks than MinSaleQty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mageprince does not look good as well, it should be better implemented as a plugin, probably legacy code.
Why do we need to duplicate this logic out of addProduct
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we misunderstood functions between addProduct() of \Magento\Quote\Model\Quote
and addProduct()
of \Magento\Checkout\Model\Cart
.
addProduct()
of \Magento\Checkout\Model\Cart
check the minimumQty
of product to addtocart
While addProductsByIds()
of \Magento\Checkout\Model\Cart
not check the minimumQty but it must required to solve this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orlangur any update for this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mageprince considering there is very similar check in Cart.php I think it's better at least to move this check to private method and reuse in both functions. I think @orlangur would like this check to be moved to CatalogInventory
module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orlangur @sivaschenko
I updated the pull request as per your suggestion.
Please review it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orlangur @sivaschenko any update on this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orlangur can you please review the changes.
Hi @sivaschenko, thank you for the review. |
@mageprince thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
….3-develop-minimumqty-related-product
Hi @mageprince, thank you for your contribution! |
Description (*)
Solve Minimum Qty Allowed in Shopping Cart not working on related products
Manual testing scenarios (*)
Advanced Inventor->Minimum Qty Allowed in Shopping Cart
Expected result (*)
Add to cart Product A with Qty = 10
Actual result (*)
Contribution checklist (*)